{"record":{"id":"e870491a9935cfe0","repo":"prestodb/presto","slug":"updatebinarystream","errorCode":null,"errorMessage":"updateBinaryStream","messagePattern":"updateBinaryStream","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java","lineNumber":879,"sourceCode":"    @Override\n    public void updateTimestamp(int columnIndex, Timestamp x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateTimestamp\");\n    }\n\n    @Override\n    public void updateAsciiStream(int columnIndex, InputStream x, int length)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateAsciiStream\");\n    }\n\n    @Override\n    public void updateBinaryStream(int columnIndex, InputStream x, int length)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateBinaryStream\");\n    }\n\n    @Override\n    public void updateCharacterStream(int columnIndex, Reader x, int length)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateCharacterStream\");\n    }\n\n    @Override\n    public void updateObject(int columnIndex, Object x, int scaleOrLength)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateObject\");\n    }\n\n    @Override\n    public void updateObject(int columnIndex, Object x)","sourceCodeStart":861,"sourceCodeEnd":897,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java#L861-L897","documentation":"PrestoResultSet.updateBinaryStream(int, InputStream, int) unconditionally throws SQLFeatureNotSupportedException(\"updateBinaryStream\"). Presto result sets are read-only; this streaming-update method is a stub that satisfies the JDBC interface and immediately rejects use. Binary stream data cannot be written into a row via the cursor.","triggerScenarios":"Calling updateBinaryStream(columnIndex, stream, length) (or label variant) on a PrestoResultSet when attempting to stream VARBINARY/blob-like data into a fetched row before updateRow().","commonSituations":"Binary-object pipelines ported from BLOB-capable JDBC drivers; media-processing jobs editing blobs in place; ORMs or persistence layers that stream large binaries through updatable result sets.","solutions":["Read the stream into a byte[] and execute a parameterized UPDATE with setBytes or setBinaryStream via the driver's parameter support.","For large objects, stage data externally (object store/Hive table) and reference or INSERT it with SQL rather than cursor updates.","Use CONCUR_READ_ONLY result sets and remove cursor-update assumptions.","Mark the datasource read-only in the data-access layer."],"exampleFix":"// before\nrs.updateBinaryStream(\"payload\", in, length);\nrs.updateRow();\n// after\nbyte[] data = in.readAllBytes();\ntry (PreparedStatement ps = conn.prepareStatement(\"UPDATE blobs SET payload = ? WHERE id = ?\")) {\n    ps.setBytes(1, data);\n    ps.setLong(2, id);\n    ps.executeUpdate();\n}","handlingStrategy":"try-catch","validationCode":"if (rs instanceof com.facebook.presto.jdbc.PrestoResultSet) {\n    // Presto: read stream to byte[] and use UPDATE with setBytes\n}","typeGuard":"boolean supportsBinaryStreamUpdate(ResultSet rs) {\n    return !(rs instanceof com.facebook.presto.jdbc.PrestoResultSet);\n}","tryCatchPattern":"try {\n    rs.updateBinaryStream(\"payload\", in, length);\n    rs.updateRow();\n} catch (SQLFeatureNotSupportedException e) {\n    // byte[] data = in.readAllBytes(); execute UPDATE with setBytes\n}","preventionTips":["Route binary writes through PreparedStatement.setBytes plus executeUpdate.","Keep large objects in object storage; store references in Presto tables.","Use CONCUR_READ_ONLY so cursor-update paths never execute.","Verify third-party persistence layers do not use streaming result-set updates with Presto."],"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"}