{"record":{"id":"d408ebe80c87ec94","repo":"prestodb/presto","slug":"deleterow","errorCode":null,"errorMessage":"deleteRow","messagePattern":"deleteRow","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java","lineNumber":1054,"sourceCode":"    @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()\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"refreshRow\");\n    }\n\n    @Override\n    public void cancelRowUpdates()\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"cancelRowUpdates\");\n    }\n\n    @Override\n    public void moveToInsertRow()","sourceCodeStart":1036,"sourceCodeEnd":1072,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java#L1036-L1072","documentation":"deleteRow() is part of the updatable result set API; Presto result sets are read-only and cannot delete rows through a cursor. The driver therefore throws SQLFeatureNotSupportedException(\"deleteRow\") unconditionally.","triggerScenarios":"Calling deleteRow() on a ResultSet created from a PrestoStatement while iterating results, intending to remove the current row from the table.","commonSituations":"Legacy CRUD code ported from OLTP drivers to Presto; data-cleanup scripts that mix reading and deleting in one pass; generic JDBC tooling assuming CONCUR_UPDATABLE.","solutions":["Issue a PreparedStatement DELETE FROM ... WHERE ... statement instead of cursor deletion","Split read and write phases: collect keys while reading, then delete with a batched SQL DELETE","Check resultSet.getConcurrency() before attempting cursor deletes and branch to SQL when read-only"],"exampleFix":"// before\nwhile (rs.next()) {\n    if (isStale(rs)) { rs.deleteRow(); }\n}\n// after\nList<Long> stale = new ArrayList<>();\nwhile (rs.next()) { if (isStale(rs)) stale.add(rs.getLong(\"id\")); }\ntry (PreparedStatement ps = conn.prepareStatement(\n        \"DELETE FROM orders WHERE id = ?\")) {\n    for (Long id : stale) { ps.setLong(1, id); ps.addBatch(); }\n    ps.executeBatch();\n}","handlingStrategy":"try-catch","validationCode":"if (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY) {\n    // use SQL DELETE instead of rs.deleteRow()\n}","typeGuard":"static boolean supportsDeleteRow(ResultSet rs) {\n    try {\n        return rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE;\n    } catch (SQLException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    rs.deleteRow();\n} catch (SQLFeatureNotSupportedException e) {\n    // issue DELETE ... WHERE via PreparedStatement\n}","preventionTips":["Delete rows with SQL DELETE statements keyed on primary keys","Split read and write phases into separate queries","Do not assume CONCUR_UPDATABLE from other drivers carries over to Presto"],"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"}