{"record":{"id":"8e7972ae5821caa1","repo":"prestodb/presto","slug":"updatebigdecimal","errorCode":null,"errorMessage":"updateBigDecimal","messagePattern":"updateBigDecimal","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java","lineNumber":830,"sourceCode":"    @Override\n    public void updateFloat(int columnIndex, float x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateFloat\");\n    }\n\n    @Override\n    public void updateDouble(int columnIndex, double x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateDouble\");\n    }\n\n    @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)","sourceCodeStart":812,"sourceCodeEnd":848,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java#L812-L848","documentation":"Presto's JDBC driver throws SQLFeatureNotSupportedException(\"updateBigDecimal\") from PrestoResultSet.updateBigDecimal(int, BigDecimal). Presto result sets are read-only: the driver implements the JDBC ResultSet update methods only to satisfy the interface, and every one is a stub that rejects the call. Updating rows through a ResultSet is not a supported operation against Presto/Trino servers.","triggerScenarios":"Calling updateBigDecimal(columnIndex, x) (or the columnName overload) on a PrestoResultSet, typically after requesting an updatable ResultSet via Connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE) and positioning the cursor on a row.","commonSituations":"Porting code written for MySQL/PostgreSQL JDBC drivers that uses updateXxx + updateRow() to modify rows in place; ORM frameworks that detect CONCUR_UPDATABLE and try in-place edits; assuming the driver honors updatable concurrency because createStatement with CONCUR_UPDATABLE does not fail.","solutions":["Replace the in-place update with an explicit SQL UPDATE statement executed via Statement/PreparedStatement.executeUpdate.","Request a read-only ResultSet (CONCUR_READ_ONLY) so intent matches driver capability and code paths depending on updatability are not taken.","If row mutation is needed, fetch results into a local data structure, modify there, and write back with parameterized UPDATE statements.","If third-party/ORM code triggers it, configure the framework to treat the Presto connection as read-only."],"exampleFix":"// before\ntry (ResultSet rs = stmt.executeQuery(\"SELECT total FROM sales WHERE id = 7\")) {\n    if (rs.next()) { rs.updateBigDecimal(1, newTotal); rs.updateRow(); }\n}\n// after\ntry (PreparedStatement ps = conn.prepareStatement(\"UPDATE sales SET total = ? WHERE id = 7\")) {\n    ps.setBigDecimal(1, newTotal);\n    ps.executeUpdate();\n}","handlingStrategy":"try-catch","validationCode":"if (rs.getStatement().getConnection().getMetaData().ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY) && rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE) {\n    // still may be unsupported; prefer explicit UPDATE for Presto\n}","typeGuard":"boolean supportsUpdatable(ResultSet rs) {\n    return rs instanceof com.facebook.presto.jdbc.PrestoResultSet ? false : rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE;\n}","tryCatchPattern":"try {\n    rs.updateBigDecimal(1, value);\n    rs.updateRow();\n} catch (SQLFeatureNotSupportedException e) {\n    // fall back to explicit UPDATE\n}","preventionTips":["Always use PreparedStatement.executeUpdate for writes against Presto.","Create statements with CONCUR_READ_ONLY to make the read-only contract explicit.","Never pair Presto result sets with updateXxx/updateRow code from legacy drivers.","Wrap Presto datasources in a read-only data-access facade so cursor-update code cannot be written against it."],"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"}