apache/seatunnel · error · SQLException
No result returned after running query [${minQuery}]
Error message
No result returned after running query [${minQuery}] What it means
PostgresUtils.queryMin runs a parameterized 'SELECT MIN(col) FROM table WHERE col > ?' query to find the next chunk max during incremental snapshot splitting. If the ResultSet has no row it throws SQLException 'No result returned after running query [..]'; the code comments this should never occur because aggregates always yield one row.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/utils/PostgresUtils.java:129
String columnName,
Column column,
Object excludedLowerBound)
throws SQLException {
columnName = quote(columnName);
if (column != null) {
columnName = JDBC_DIALECT.convertType(columnName, column.typeName());
}
final String minQuery =
String.format(
"SELECT MIN(%s) FROM %s WHERE %s > ?",
columnName, quote(tableId), columnName);
return jdbc.prepareQueryAndMap(
minQuery,
ps -> ps.setObject(1, excludedLowerBound),
rs -> {
if (!rs.next()) {
// this should never happen
throw new SQLException(
String.format(
"No result returned after running query [%s]", minQuery));
}
return rs.getObject(1);
});
}
public static Object[] sampleDataFromColumn(
JdbcConnection jdbc, TableId tableId, String columnName, int inverseSamplingRate)
throws SQLException {
final String minQuery =
String.format(
"SELECT %s FROM %s WHERE MOD((%s - (SELECT MIN(%s) FROM %s)), %s) = 0 ORDER BY %s",
quote(columnName),
quote(tableId),
quote(columnName),
quote(columnName),
quote(tableId),View on GitHub (pinned to cf67b549a7)
Solutions
- Run the printed minQuery manually against the database to confirm behavior
- Check for statement_timeout or cancellations in Postgres logs for this query
- Verify network/connection stability and retry the failing split
- Update the Postgres JDBC driver if using an old version with known result-set issues
Defensive patterns
Strategy: retry
Try / catch
try { min = PostgresUtils.queryMin(jdbc, tableId, col, lowerBound); } catch (SQLException e) { log.warn("retry chunk min: {}", e.getMessage()); } Prevention
- Raise statement_timeout for chunk-boundary scans
- Keep connections alive (TCP keepalive) during long snapshots
- Check Postgres logs for cancellations
When it happens
Trigger: rs.next() is false for the MIN aggregate query — abnormal driver/connection behavior, cancelled statement, or result set closed before iteration. Not triggered merely by zero matching rows (MIN would return NULL, not an empty set).
Common situations: Statement cancellation due to timeout on a very large table; connection invalidated mid-query; JDBC proxy/firewall stripping results.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- No result returned after running query [${query}]
- No result returned after running query [${minMaxQuery}]
- Couldn't obtain encoding for database <database>
- Couldn't get timestamp utils from underlying connection
- Snapshotting of table ${table.id()} failed
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/ed869a79029e1c01.
Report an issue: GitHub.