prestodb/presto · error · SQLFeatureNotSupportedException
getRef
Error message
getRef
What it means
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.
Source
Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:1102
@Override
public Statement getStatement()
{
return statement;
}
@Override
public Object getObject(int columnIndex, Map<String, Class<?>> map)
throws SQLException
{
throw new SQLFeatureNotSupportedException("getObject");
}
@Override
public Ref getRef(int columnIndex)
throws SQLException
{
throw new SQLFeatureNotSupportedException("getRef");
}
@Override
public Blob getBlob(int columnIndex)
throws SQLException
{
throw new SQLFeatureNotSupportedException("getBlob");
}
@Override
public Clob getClob(int columnIndex)
throws SQLException
{
throw new SQLFeatureNotSupportedException("getClob");
}
@Override
public Array getArray(int columnIndex)View on GitHub (pinned to 55bb57d202)
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
Example fix
// before
Ref ref = rs.getRef("owner");
Person owner = ref.getObject(Person.class);
// after
long ownerId = rs.getLong("owner_id");
Person owner = personDao.findById(ownerId); Defensive patterns
Strategy: type-guard
Validate before calling
int type = rs.getMetaData().getColumnType(col);
if (type == java.sql.Types.REF
|| type == java.sql.Types.REF_CURSOR) {
throw new IllegalStateException("REF not supported by Presto");
} Type guard
static boolean isRefColumn(ResultSetMetaData md, int col) throws SQLException {
return md.getColumnType(col) == Types.REF;
} Try / catch
try {
return rs.getRef(col);
} catch (SQLFeatureNotSupportedException e) {
return null; // model reference via a plain ID column instead
} Prevention
- 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
When it happens
Trigger: Calling rs.getRef(columnIndex) or getRef(columnLabel) on a PrestoResultSet.
Common situations: Code ported from Oracle (where REF columns exist); generic JDBC metadata-driven readers that probe for REF support; ORM mappings that include SqlRef fields.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/13ec1c4a27a321db.
Report an issue: GitHub.