prestodb/presto · error · SQLFeatureNotSupportedException

updateBigDecimal

Error message

updateBigDecimal

What it means

Presto's JDBC driver throws SQLFeatureNotSupportedException("updateBigDecimal") from PrestoResultSet.updateBigDecimal(int, BigDecimal). Presto result sets are read-only: the driver implements the JDBC ResultSet update methods only to satisfy the interface, and every one is a stub that rejects the call. Updating rows through a ResultSet is not a supported operation against Presto/Trino servers.

Source

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

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

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

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

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

    @Override
    public void updateBytes(int columnIndex, byte[] x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateBytes");
    }

    @Override
    public void updateDate(int columnIndex, Date x)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Replace the in-place update with an explicit SQL UPDATE statement executed via Statement/PreparedStatement.executeUpdate.
  2. Request a read-only ResultSet (CONCUR_READ_ONLY) so intent matches driver capability and code paths depending on updatability are not taken.
  3. If row mutation is needed, fetch results into a local data structure, modify there, and write back with parameterized UPDATE statements.
  4. If third-party/ORM code triggers it, configure the framework to treat the Presto connection as read-only.

Example fix

// before
try (ResultSet rs = stmt.executeQuery("SELECT total FROM sales WHERE id = 7")) {
    if (rs.next()) { rs.updateBigDecimal(1, newTotal); rs.updateRow(); }
}
// after
try (PreparedStatement ps = conn.prepareStatement("UPDATE sales SET total = ? WHERE id = 7")) {
    ps.setBigDecimal(1, newTotal);
    ps.executeUpdate();
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (rs.getStatement().getConnection().getMetaData().ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY) && rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE) {
    // still may be unsupported; prefer explicit UPDATE for Presto
}

Type guard

boolean supportsUpdatable(ResultSet rs) {
    return rs instanceof com.facebook.presto.jdbc.PrestoResultSet ? false : rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE;
}

Try / catch

try {
    rs.updateBigDecimal(1, value);
    rs.updateRow();
} catch (SQLFeatureNotSupportedException e) {
    // fall back to explicit UPDATE
}

Prevention

When it happens

Trigger: Calling updateBigDecimal(columnIndex, x) (or the columnName overload) on a PrestoResultSet, typically after requesting an updatable ResultSet via Connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE) and positioning the cursor on a row.

Common situations: Porting code written for MySQL/PostgreSQL JDBC drivers that uses updateXxx + updateRow() to modify rows in place; ORM frameworks that detect CONCUR_UPDATABLE and try in-place edits; assuming the driver honors updatable concurrency because createStatement with CONCUR_UPDATABLE does not fail.

Related errors


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