prestodb/presto · error · SQLFeatureNotSupportedException

updateTimestamp

Error message

updateTimestamp

What it means

PrestoResultSet.updateTimestamp(int, java.sql.Timestamp) unconditionally throws SQLFeatureNotSupportedException("updateTimestamp"). Presto result sets are read-only; this method exists only to complete the java.sql.ResultSet interface and rejects the call immediately. TIMESTAMP columns cannot be updated through the cursor.

Source

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

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

    @Override
    public void updateBinaryStream(int columnIndex, InputStream x, int length)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateBinaryStream");
    }

    @Override
    public void updateCharacterStream(int columnIndex, Reader x, int length)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Issue a parameterized UPDATE (setTimestamp) to change the timestamp column.
  2. For touch patterns, use a single statement like UPDATE t SET modified_at = now() WHERE id IN (...).
  3. Use CONCUR_READ_ONLY result sets and avoid cursor-update code paths.
  4. Configure the data-access layer to treat Presto as read-only.

Example fix

// before
rs.updateTimestamp("modified_at", now);
rs.updateRow();
// after
try (PreparedStatement ps = conn.prepareStatement("UPDATE t SET modified_at = current_timestamp WHERE id = ?")) {
    ps.setLong(1, id);
    ps.executeUpdate();
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (rs instanceof com.facebook.presto.jdbc.PrestoResultSet) {
    // Presto: stamp timestamps with UPDATE ... SET modified_at = current_timestamp
}

Type guard

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

Try / catch

try {
    rs.updateTimestamp("modified_at", now);
    rs.updateRow();
} catch (SQLFeatureNotSupportedException e) {
    // run UPDATE t SET modified_at = current_timestamp WHERE id = ?
}

Prevention

When it happens

Trigger: Calling updateTimestamp(columnIndex, ts) or updateTimestamp(columnLabel, ts) on a PrestoResultSet, typically before updateRow(), when trying to set a TIMESTAMP/TIMESTAMP WITH TIME ZONE column in a fetched row.

Common situations: Porting audit-timestamp-stamping code from traditional RDBMS drivers; touch-style jobs that update modified_at per row via the cursor; ORMs with updatable result sets enabled against Presto.

Related errors


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