{"record":{"id":"3ce3449f5506a1e0","repo":"prestodb/presto","slug":"updatebytes","errorCode":null,"errorMessage":"updateBytes","messagePattern":"updateBytes","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java","lineNumber":844,"sourceCode":"    @Override\n    public void updateBigDecimal(int columnIndex, BigDecimal x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateBigDecimal\");\n    }\n\n    @Override\n    public void updateString(int columnIndex, String x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateString\");\n    }\n\n    @Override\n    public void updateBytes(int columnIndex, byte[] x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateBytes\");\n    }\n\n    @Override\n    public void updateDate(int columnIndex, Date x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateDate\");\n    }\n\n    @Override\n    public void updateTime(int columnIndex, Time x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateTime\");\n    }\n\n    @Override\n    public void updateTimestamp(int columnIndex, Timestamp x)","sourceCodeStart":826,"sourceCodeEnd":862,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java#L826-L862","documentation":"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.","triggerScenarios":"Calling updateBytes(columnIndex, bytes) (or the label variant) on a PrestoResultSet when attempting to write a VARBINARY column in place before calling updateRow().","commonSituations":"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.","solutions":["Execute a parameterized UPDATE with setBytes to write the binary data.","Treat the Presto connection as read-only and stage changes in application memory, then write back with SQL.","Request CONCUR_READ_ONLY result sets so no code path attempts cursor updates.","If middleware triggers it, disable updatable-result-set features for this datasource."],"exampleFix":"// before\nrs.updateBytes(2, payload);\nrs.updateRow();\n// after\ntry (PreparedStatement ps = conn.prepareStatement(\"UPDATE files SET payload = ? WHERE id = ?\")) {\n    ps.setBytes(1, payload);\n    ps.setLong(2, id);\n    ps.executeUpdate();\n}","handlingStrategy":"try-catch","validationCode":"if (rs instanceof com.facebook.presto.jdbc.PrestoResultSet) {\n    throw new IllegalStateException(\"Presto result sets are read-only; use SQL UPDATE with setBytes\");\n}","typeGuard":"boolean canUpdateInPlace(ResultSet rs) {\n    return !(rs instanceof com.facebook.presto.jdbc.PrestoResultSet) && rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE;\n}","tryCatchPattern":"try {\n    rs.updateBytes(2, payload);\n    rs.updateRow();\n} catch (SQLFeatureNotSupportedException e) {\n    // execute UPDATE ... SET payload = ? instead\n}","preventionTips":["Route all binary writes through PreparedStatement.setBytes/setBinaryStream + executeUpdate.","Never rely on CONCUR_UPDATABLE with Presto; the driver does not implement it.","Store large binaries in object storage and reference them, rather than editing blob columns via cursors.","Test migration code paths against Presto with a read-only assertion."],"tags":["jdbc","sqlfeaturenotsupportedexception","read-only-resultset","presto"],"backgroundTag":"jdbc-updatable-resultset-not-supported","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}