{"record":{"id":"6589e21350e7f61b","repo":"prestodb/presto","slug":"insertrow","errorCode":null,"errorMessage":"insertRow","messagePattern":"insertRow","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java","lineNumber":1040,"sourceCode":"    @Override\n    public void updateObject(String columnLabel, Object x, int scaleOrLength)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateObject\");\n    }\n\n    @Override\n    public void updateObject(String columnLabel, Object x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateObject\");\n    }\n\n    @Override\n    public void insertRow()\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"insertRow\");\n    }\n\n    @Override\n    public void updateRow()\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"updateRow\");\n    }\n\n    @Override\n    public void deleteRow()\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"deleteRow\");\n    }\n\n    @Override\n    public void refreshRow()","sourceCodeStart":1022,"sourceCodeEnd":1058,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java#L1022-L1058","documentation":"Presto's JDBC driver implements read-only, forward-only result sets. insertRow() is part of the JDBC updatable-resultset API, which Presto does not support, so the method unconditionally throws SQLFeatureNotSupportedException with the method name as the message. The driver exposes the method only to satisfy the java.sql.ResultSet interface.","triggerScenarios":"Calling insertRow() on a java.sql.ResultSet obtained from a PrestoConnection (via PrestoStatement), typically after moveToInsertRow() in code written for updatable result sets.","commonSituations":"Porting legacy MySQL/PostgreSQL JDBC code that writes rows through ResultSet objects to Presto; ORM or report-builder code that assumes a CONCUR_UPDATABLE result set; generic JDBC frameworks that probe updatable-resultset capabilities.","solutions":["Rewrite the code to INSERT via Statement/PreparedStatement (executeUpdate of an INSERT statement) instead of using ResultSet row insertion","Check result-set capabilities first with resultSet.getConcurrency() == ResultSet.CONCUR_READ_ONLY and take the SQL path when updatable is unavailable","If row writes through a cursor are required, use a database that supports updatable result sets; Presto results are read-only by design"],"exampleFix":"// before\nResultSet rs = stmt.executeQuery(\"SELECT * FROM orders\");\nrs.moveToInsertRow();\nrs.updateString(\"status\", \"SHIPPED\");\nrs.insertRow();\n// after\ntry (PreparedStatement ps = conn.prepareStatement(\n        \"INSERT INTO orders (status) VALUES (?)\")) {\n    ps.setString(1, \"SHIPPED\");\n    ps.executeUpdate();\n}","handlingStrategy":"try-catch","validationCode":"if (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY) {\n    // use SQL INSERT instead of rs.insertRow()\n}","typeGuard":"static boolean supportsInsertRow(ResultSet rs) {\n    try {\n        return rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE;\n    } catch (SQLException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    rs.insertRow();\n} catch (SQLFeatureNotSupportedException e) {\n    // fall back to PreparedStatement INSERT\n}","preventionTips":["Treat Presto result sets as read-only by default","Check getConcurrency() before any updatable-resultset API call","Write data with PreparedStatement INSERT/UPDATE/DELETE statements"],"tags":["jdbc","presto","unsupported-feature","sqlfeaturenotsupported"],"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"}