prestodb/presto · error · SQLException

Error executing query

Error message

Error executing query

What it means

In internalExecute, any PrestoException/ClientException raised by the query client during statement execution is caught and rethrown as this SQLException with the original exception as the cause. It is a generic wrapper meaning the server-side query failed (syntax error, table missing, session error, etc.); inspect getCause() for the real reason.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoStatement.java:307

            // this is an update, not a query
            while (resultSet.next()) {
                // ignore rows
            }

            connection().updateSession(client);

            Long updateCount = client.finalStatusInfo().getUpdateCount();
            currentUpdateCount.set((updateCount != null) ? updateCount : 0);
            currentUpdateType.set(client.finalStatusInfo().getUpdateType());
            warningsManager.addWarnings(client.finalStatusInfo().getWarnings());
            return false;
        }
        catch (ClientException e) {
            throw new SQLException(e.getMessage(), e);
        }
        catch (RuntimeException e) {
            throw new SQLException("Error executing query", e);
        }
        finally {
            this.statementDepth.decrementAndGet();
            executingClient.set(null);
            if (currentResult.get() == null) {
                if (resultSet != null) {
                    resultSet.close();
                }
                if (client != null) {
                    client.close();
                }
            }
        }
    }

    private void clearCurrentResults()
            throws SQLException
    {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Inspect the cause (SQLException.getCause()) or the associated PrestoException error code for the underlying failure
  2. Log the query ID from the exception to look up server-side details
  3. Retry transient failures (e.g. connection issues) and fix SQL/schema errors permanently
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoStatement.java:307 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/c8295add4eb13778. Report an issue: GitHub.