prestodb/presto · warning · SQLFeatureNotSupportedException

setRowId

Error message

setRowId

What it means

PrestoPreparedStatement.setRowId is a stub that unconditionally throws SQLFeatureNotSupportedException. The Presto JDBC driver cannot bind java.sql.RowId parameters, since Presto tables do not expose JDBC ROWID locators. Binding must be done with an actual supported value type.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java:568

    @Override
    public void setURL(int parameterIndex, URL x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("setURL");
    }

    @Override
    public ParameterMetaData getParameterMetaData()
            throws SQLException
    {
        throw new NotImplementedException("PreparedStatement", "getParameterMetaData");
    }

    @Override
    public void setRowId(int parameterIndex, RowId x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("setRowId");
    }

    @Override
    public void setNString(int parameterIndex, String value)
            throws SQLException
    {
        setString(parameterIndex, value);
    }

    @Override
    public void setNCharacterStream(int parameterIndex, Reader value, long length)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("setNCharacterStream");
    }

    @Override
    public void setNClob(int parameterIndex, NClob value)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Bind the row identifier as its logical value with setString or setObject instead of a RowId handle
  2. Remove positioned-update logic; Presto does not support WHERE CURRENT OF style RowId updates
  3. Restructure the query to reference primary key columns directly

Example fix

// before
pstmt.setRowId(1, rowId);
// after
pstmt.setString(1, rowId.toString()); // or use the PK column value
Defensive patterns

Strategy: fallback

Validate before calling

if (value instanceof java.sql.RowId) { pstmt.setString(parameterIndex, ((java.sql.RowId) value).getBytes().toString()); } else { pstmt.setObject(parameterIndex, value); }

Type guard

boolean isBindableDirectly(Object v) { return !(v instanceof java.sql.RowId || v instanceof java.sql.SQLXML || v instanceof java.sql.NClob); }

Try / catch

try { pstmt.setRowId(idx, rowId); } catch (SQLFeatureNotSupportedException e) { pstmt.setString(idx, new String(rowId.getBytes(), StandardCharsets.UTF_8)); }

Prevention

When it happens

Trigger: Calling PreparedStatement.setRowId(int parameterIndex, java.sql.RowId x) on a PrestoPreparedStatement; JDBC code that retrieves a RowId from another database and passes it into a Presto statement.

Common situations: Porting OLTP JDBC code (Oracle/DB2 ROWID patterns) to Presto; frameworks that bind RowId columns for positioned updates.

Related errors


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