prestodb/presto · error · SQLFeatureNotSupportedException

updateRef

Error message

updateRef

What it means

Presto result sets are forward-only, read-only; no update* method is implemented. updateRef(int, Ref) always throws SQLFeatureNotSupportedException("updateRef") — the driver never supports positioned updates or REF types.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:1229

    @Override
    public URL getURL(int columnIndex)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("getURL");
    }

    @Override
    public URL getURL(String columnLabel)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("getURL");
    }

    @Override
    public void updateRef(int columnIndex, Ref x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateRef");
    }

    @Override
    public void updateRef(String columnLabel, Ref x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateRef");
    }

    @Override
    public void updateBlob(int columnIndex, Blob x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateBlob");
    }

    @Override
    public void updateBlob(String columnLabel, Blob x)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Do not update via ResultSet — issue an explicit UPDATE statement through Statement/PreparedStatement
  2. Refactor the data-access layer so result sets are read-only
  3. If REF semantics were used, model the relationship with plain columns

Example fix

// before
rs.updateRef(1, ref);
rs.updateRow();
// after
try (PreparedStatement ps = conn.prepareStatement("UPDATE t SET ref_col = ? WHERE id = ?")) {
    ps.setString(1, refValue);
    ps.setLong(2, id);
    ps.executeUpdate();
}
Defensive patterns

Strategy: validation

Validate before calling

DatabaseMetaData md = conn.getMetaData();
if (!md.supportsResultSetConcurrency(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE)) { /* use UPDATE statements */ }

Try / catch

try {
    rs.updateRef(columnIndex, ref);
} catch (SQLFeatureNotSupportedException e) {
    // fall back to PreparedStatement UPDATE
}

Prevention

When it happens

Trigger: Calling rs.updateRef(columnIndex, ref) on an updatable-ResultSet code path with a PrestoResultSet.

Common situations: Code ported from desktop-style JDBC apps (e.g. Derby/Oracle updatable result sets); frameworks that attempt row updates through ResultSet.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/4487647b5459ace7. Report an issue: GitHub.