{"record":{"id":"67a4466cab4fa0c8","repo":"prestodb/presto","slug":"updatecharacterstream","errorCode":null,"errorMessage":"updateCharacterStream","messagePattern":"updateCharacterStream","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java","lineNumber":886,"sourceCode":"    @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)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateObject\");\n    }\n\n    @Override\n    public void updateNull(String columnLabel)","sourceCodeStart":868,"sourceCodeEnd":904,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java#L868-L904","documentation":"PrestoResultSet.updateCharacterStream(int, Reader, int) always throws SQLFeatureNotSupportedException(\"updateCharacterStream\"). The Presto JDBC driver offers read-only result sets; character-stream update methods are stubs that reject the call. Text data cannot be streamed into a row through the ResultSet cursor.","triggerScenarios":"Calling updateCharacterStream(columnIndex, reader, length) (or label/length variants) on a PrestoResultSet, typically to fill a large VARCHAR column from a Reader before updateRow().","commonSituations":"CLOB-style code ported from Oracle/MySQL JDBC usage; document-ingestion jobs updating text columns row by row; persistence frameworks that stream character data through updatable result sets.","solutions":["Read the Reader into a String in application code and execute a parameterized UPDATE with setString.","Use bulk SQL loading (INSERT INTO ... SELECT from staged text data) instead of per-row cursor updates.","Request CONCUR_READ_ONLY so cursor-update paths are not relied upon.","Configure the ORM/persistence layer to treat the Presto connection as read-only."],"exampleFix":"// before\nrs.updateCharacterStream(\"body\", reader, length);\nrs.updateRow();\n// after\nString body = new BufferedReader(reader).lines().collect(Collectors.joining(\"\\n\"));\ntry (PreparedStatement ps = conn.prepareStatement(\"UPDATE docs SET body = ? WHERE id = ?\")) {\n    ps.setString(1, body);\n    ps.setLong(2, id);\n    ps.executeUpdate();\n}","handlingStrategy":"try-catch","validationCode":"if (rs instanceof com.facebook.presto.jdbc.PrestoResultSet) {\n    // Presto: collect Reader into String, then UPDATE with setString\n}","typeGuard":"boolean allowsCharacterStreamUpdate(ResultSet rs) {\n    return !(rs instanceof com.facebook.presto.jdbc.PrestoResultSet);\n}","tryCatchPattern":"try {\n    rs.updateCharacterStream(\"body\", reader, length);\n    rs.updateRow();\n} catch (SQLFeatureNotSupportedException e) {\n    // materialize text and run parameterized UPDATE\n}","preventionTips":["Materialize Reader content in the application before writing it with a PreparedStatement.","Use staged-file ingestion plus INSERT INTO ... SELECT for bulk document loads.","Create Presto statements with CONCUR_READ_ONLY.","Grep codebases for updateCharacterStream/updateAsciiStream when migrating to 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"}