{"record":{"id":"13ec1c4a27a321db","repo":"prestodb/presto","slug":"getref","errorCode":null,"errorMessage":"getRef","messagePattern":"getRef","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java","lineNumber":1102,"sourceCode":"\n    @Override\n    public Statement getStatement()\n    {\n        return statement;\n    }\n\n    @Override\n    public Object getObject(int columnIndex, Map<String, Class<?>> map)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"getObject\");\n    }\n\n    @Override\n    public Ref getRef(int columnIndex)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"getRef\");\n    }\n\n    @Override\n    public Blob getBlob(int columnIndex)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"getBlob\");\n    }\n\n    @Override\n    public Clob getClob(int columnIndex)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"getClob\");\n    }\n\n    @Override\n    public Array getArray(int columnIndex)","sourceCodeStart":1084,"sourceCodeEnd":1120,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java#L1084-L1120","documentation":"PrestoResultSet does not implement the JDBC Ref type: getRef is one of a family of sentinel methods that unconditionally throw SQLFeatureNotSupportedException, with the method name as the message. It fires whenever client code calls the unsupported accessor, not because of bad data.","triggerScenarios":"Calling rs.getRef(columnIndex) or getRef(columnLabel) on a PrestoResultSet.","commonSituations":"Code ported from Oracle (where REF columns exist); generic JDBC metadata-driven readers that probe for REF support; ORM mappings that include SqlRef fields.","solutions":["Remove REF handling from the Presto code path; model references as ordinary columns (IDs) and fetch them with SQL joins","Skip REF columns in metadata-driven readers (check ResultSetMetaData.getColumnType != Types.REF)","If object references are needed, resolve them with a second query instead of JDBC Ref objects"],"exampleFix":"// before\nRef ref = rs.getRef(\"owner\");\nPerson owner = ref.getObject(Person.class);\n// after\nlong ownerId = rs.getLong(\"owner_id\");\nPerson owner = personDao.findById(ownerId);","handlingStrategy":"type-guard","validationCode":"int type = rs.getMetaData().getColumnType(col);\nif (type == java.sql.Types.REF\n        || type == java.sql.Types.REF_CURSOR) {\n    throw new IllegalStateException(\"REF not supported by Presto\");\n}","typeGuard":"static boolean isRefColumn(ResultSetMetaData md, int col) throws SQLException {\n    return md.getColumnType(col) == Types.REF;\n}","tryCatchPattern":"try {\n    return rs.getRef(col);\n} catch (SQLFeatureNotSupportedException e) {\n    return null; // model reference via a plain ID column instead\n}","preventionTips":["Do not use SQL REF/structured types with Presto; use plain ID columns and joins","Filter Types.REF columns out of metadata-driven readers","Keep ORM mappings free of java.sql.Ref fields for Presto datasources"],"tags":["jdbc","presto","unsupported-feature","sql-ref","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"}