prestodb/presto · error · SQLFeatureNotSupportedException

updateDate

Error message

updateDate

What it means

PrestoResultSet.updateDate(int, java.sql.Date) unconditionally throws SQLFeatureNotSupportedException("updateDate"). Presto result sets are read-only; every ResultSet updateXxx method in the driver is a stub that rejects the call rather than buffering an in-row change. DATE columns cannot be edited through the cursor.

Source

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

    @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)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateDate");
    }

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

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

    @Override
    public void updateAsciiStream(int columnIndex, InputStream x, int length)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Run an explicit UPDATE statement (PreparedStatement.setDate) instead of a cursor update.
  2. Use a set-based UPDATE for many rows, e.g. UPDATE t SET d = DATE_ADD('day', 1, d) WHERE ...
  3. Declare CONCUR_READ_ONLY so accidental update code paths are not relied upon.
  4. Configure the ORM/driver layer to mark the Presto catalog read-only.

Example fix

// before
rs.updateDate("due_date", newDue);
rs.updateRow();
// after
try (PreparedStatement ps = conn.prepareStatement("UPDATE tasks SET due_date = ? WHERE id = ?")) {
    ps.setDate(1, newDue);
    ps.setLong(2, id);
    ps.executeUpdate();
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (rs instanceof com.facebook.presto.jdbc.PrestoResultSet) {
    // use PreparedStatement.setDate + executeUpdate instead of updateDate
}

Type guard

boolean supportsCursorUpdate(ResultSet rs) {
    return !(rs instanceof com.facebook.presto.jdbc.PrestoResultSet);
}

Try / catch

try {
    rs.updateDate("due_date", newDue);
    rs.updateRow();
} catch (SQLFeatureNotSupportedException e) {
    // run UPDATE tasks SET due_date = ? WHERE id = ?
}

Prevention

When it happens

Trigger: Calling updateDate(columnIndex, date) or updateDate(columnLabel, date) on a PrestoResultSet, typically followed by updateRow(), when trying to modify a DATE column in a fetched row.

Common situations: Legacy data-correction scripts written for Oracle/MySQL ported to Presto; batch jobs that shift dates row by row via the cursor; ORM updatable-result-set support enabled against Presto.

Related errors


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