{"record":{"id":"506328ca889a6c8e","repo":"prestodb/presto","slug":"previous","errorCode":null,"errorMessage":"previous","messagePattern":"previous","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java","lineNumber":692,"sourceCode":"    @Override\n    public boolean absolute(int row)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"absolute\");\n    }\n\n    @Override\n    public boolean relative(int rows)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"relative\");\n    }\n\n    @Override\n    public boolean previous()\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"previous\");\n    }\n\n    @Override\n    public void setFetchDirection(int direction)\n            throws SQLException\n    {\n        checkOpen();\n        if (direction != FETCH_FORWARD) {\n            throw new SQLException(\"Fetch direction must be FETCH_FORWARD\");\n        }\n    }\n\n    @Override\n    public int getFetchDirection()\n            throws SQLException\n    {\n        checkOpen();\n        return FETCH_FORWARD;","sourceCodeStart":674,"sourceCodeEnd":710,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java#L674-L710","documentation":"previous() in PrestoResultSet always throws SQLFeatureNotSupportedException: result sets are TYPE_FORWARD_ONLY, so backward cursor movement through the rows is impossible and the method is unimplemented.","triggerScenarios":"Calling ResultSet.previous() on a PrestoResultSet after advancing with next().","commonSituations":"Iterators that occasionally step backward, or code written against scrollable result sets on other databases reused with Presto.","solutions":["Restructure logic to a single forward pass, buffering any rows you may need again","Re-execute the query to restart iteration","Collect rows into a ListIterator-backed in-memory structure for bidirectional traversal"],"exampleFix":"// before\nrs.next(); rs.next(); rs.previous(); // step back\n// after\nList<Row> rows = new ArrayList<>();\nwhile (rs.next()) { rows.add(readRow(rs)); }\nListIterator<Row> it = rows.listIterator();","handlingStrategy":"try-catch","validationCode":"DatabaseMetaData md = conn.getMetaData();\nif (!md.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE)) { /* no backward iteration */ }","typeGuard":null,"tryCatchPattern":"try { rs.previous(); } catch (SQLFeatureNotSupportedException e) { /* buffer rows or re-execute */ }","preventionTips":["Design iteration as single-pass forward only","Buffer rows in a List when bidirectional access is required","Restart iteration by re-executing the statement"],"tags":["jdbc","unsupported-operation","forward-only-resultset"],"backgroundTag":"jdbc-resultset-navigation-unsupported","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"}