{"record":{"id":"309ac5ca00370bd7","repo":"prestodb/presto","slug":"updatencharacterstream","errorCode":null,"errorMessage":"updateNCharacterStream","messagePattern":"updateNCharacterStream","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java","lineNumber":1426,"sourceCode":"    @Override\n    public Reader getNCharacterStream(int columnIndex)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"getNCharacterStream\");\n    }\n\n    @Override\n    public Reader getNCharacterStream(String columnLabel)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"getNCharacterStream\");\n    }\n\n    @Override\n    public void updateNCharacterStream(int columnIndex, Reader x, long length)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateNCharacterStream\");\n    }\n\n    @Override\n    public void updateNCharacterStream(String columnLabel, Reader reader, long length)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateNCharacterStream\");\n    }\n\n    @Override\n    public void updateAsciiStream(int columnIndex, InputStream x, long length)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateAsciiStream\");\n    }\n\n    @Override\n    public void updateBinaryStream(int columnIndex, InputStream x, long length)","sourceCodeStart":1408,"sourceCodeEnd":1444,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java#L1408-L1444","documentation":"Presto's JDBC driver treats result sets as read-only and does not implement any of the JDBC updatable-result-set APIs; PrestoResultSet.updateNCharacterStream(int, Reader, long) therefore throws SQLFeatureNotSupportedException naming the method.","triggerScenarios":"Calling updateNCharacterStream(int columnIndex, Reader x, long length) on a Presto result set, typically after positioning on a row with intent to modify it in place.","commonSituations":"Code written against updatable result sets from other databases; attempt to patch data through the ResultSet instead of issuing SQL UPDATE via Statement; frameworks that optimistically use updatable result sets when CONCUR_UPDATABLE is requested.","solutions":["Execute an explicit SQL UPDATE via Statement/PreparedStatement instead of updating through the ResultSet","Do not request CONCUR_UPDATABLE result sets from Presto; use READ_ONLY concurrency","Move mutation logic to a layer that issues DML queries"],"exampleFix":"// before\nrs.updateNCharacterStream(\"notes\", reader, len);\n// after\ntry (PreparedStatement ps = conn.prepareStatement(\"UPDATE t SET notes = ? WHERE id = ?\")) {\n    ps.setCharacterStream(1, reader, len);\n    ps.setLong(2, id);\n    ps.executeUpdate();\n}","handlingStrategy":"try-catch","validationCode":"if (rs.getConcurrency() != ResultSet.CONCUR_READ_ONLY) { /* Presto only gives READ_ONLY; updates will fail */ }","typeGuard":"boolean supportsResultSetUpdates(ResultSet rs) {\n    return !(rs instanceof com.facebook.presto.jdbc.PrestoResultSet);\n}","tryCatchPattern":"try {\n    rs.updateNCharacterStream(1, reader, len);\n} catch (SQLFeatureNotSupportedException e) {\n    throw new UnsupportedOperationException(\"Use PreparedStatement UPDATE; Presto result sets are read-only\", e);\n}","preventionTips":["Never use ResultSet updateXxx/updateRow against Presto — issue DML statements instead","Keep result set concurrency CONCUR_READ_ONLY for Presto connections","Centralize write operations in SQL statements, not row-based updates"],"tags":["jdbc","unsupported-feature","read-only-resultset","presto"],"backgroundTag":"unsupported-jdbc-feature","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"}