{"record":{"id":"9973085ecf76e80f","repo":"prestodb/presto","slug":"fetch-size-must-be-positive","errorCode":null,"errorMessage":"Fetch size must be positive","messagePattern":"Fetch size must be positive","errorType":"validation","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoStatement.java","lineNumber":390,"sourceCode":"        }\n        // ignore: fetch direction is always forward\n    }\n\n    @Override\n    public int getFetchDirection()\n            throws SQLException\n    {\n        checkOpen();\n        return ResultSet.FETCH_FORWARD;\n    }\n\n    @Override\n    public void setFetchSize(int rows)\n            throws SQLException\n    {\n        checkOpen();\n        if (rows < 0) {\n            throw new SQLException(\"Fetch size must be positive\");\n        }\n        fetchSize.set(rows);\n    }\n\n    @Override\n    public int getFetchSize()\n            throws SQLException\n    {\n        checkOpen();\n        return fetchSize.get();\n    }\n\n    @Override\n    public int getResultSetConcurrency()\n            throws SQLException\n    {\n        checkOpen();\n        return ResultSet.CONCUR_READ_ONLY;","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoStatement.java#L372-L408","documentation":"setFetchSize in PrestoStatement rejects negative values with this SQLException: a fetch size must be zero (driver default) or a positive row count. It is a pure input validation guard before storing the value in fetchSize.","triggerScenarios":"Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoStatement.java:390 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass 0 to use the driver default or a positive integer for the fetch size","Validate configured fetch-size settings before applying them to statements","Catch SQLException when fetch size originates from external configuration"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}