prestodb/presto · error · SQLFeatureNotSupportedException

updateBytes

Error message

updateBytes

What it means

PrestoResultSet.updateBytes(int, byte[]) always throws SQLFeatureNotSupportedException("updateBytes"). The Presto JDBC driver does not support updatable result sets; this method exists only to implement java.sql.ResultSet and is a stub that rejects the call. Binary column values cannot be changed through the cursor.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:844

    @Override
    public void updateBigDecimal(int columnIndex, BigDecimal x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateBigDecimal");
    }

    @Override
    public void updateString(int columnIndex, String x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateString");
    }

    @Override
    public void updateBytes(int columnIndex, byte[] x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateBytes");
    }

    @Override
    public void updateDate(int columnIndex, Date x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateDate");
    }

    @Override
    public void updateTime(int columnIndex, Time x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateTime");
    }

    @Override
    public void updateTimestamp(int columnIndex, Timestamp x)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Execute a parameterized UPDATE with setBytes to write the binary data.
  2. Treat the Presto connection as read-only and stage changes in application memory, then write back with SQL.
  3. Request CONCUR_READ_ONLY result sets so no code path attempts cursor updates.
  4. If middleware triggers it, disable updatable-result-set features for this datasource.

Example fix

// before
rs.updateBytes(2, payload);
rs.updateRow();
// after
try (PreparedStatement ps = conn.prepareStatement("UPDATE files SET payload = ? WHERE id = ?")) {
    ps.setBytes(1, payload);
    ps.setLong(2, id);
    ps.executeUpdate();
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (rs instanceof com.facebook.presto.jdbc.PrestoResultSet) {
    throw new IllegalStateException("Presto result sets are read-only; use SQL UPDATE with setBytes");
}

Type guard

boolean canUpdateInPlace(ResultSet rs) {
    return !(rs instanceof com.facebook.presto.jdbc.PrestoResultSet) && rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE;
}

Try / catch

try {
    rs.updateBytes(2, payload);
    rs.updateRow();
} catch (SQLFeatureNotSupportedException e) {
    // execute UPDATE ... SET payload = ? instead
}

Prevention

When it happens

Trigger: Calling updateBytes(columnIndex, bytes) (or the label variant) on a PrestoResultSet when attempting to write a VARBINARY column in place before calling updateRow().

Common situations: Porting BLOB/bytea update logic from MySQL/PostgreSQL JDBC code; image or binary-patch pipelines that stream results and edit them in place; frameworks that assume all declared-updatable result sets truly are.

Related errors


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