apache/shardingsphere · error · SQLFeatureNotSupportedException

rowUpdated

Error message

rowUpdated

What it means

rowUpdated() throws SQLFeatureNotSupportedException in the federation ResultSet. The method reports whether the current row has been visibly updated (own-updates-detected mode); federation result sets are read-only snapshots, so no update visibility model exists and every call is rejected (the method is final).

Source

Thrown at kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java:135

    
    @Override
    public final void moveToInsertRow() throws SQLException {
        throw new SQLFeatureNotSupportedException("moveToInsertRow");
    }
    
    @Override
    public final void moveToCurrentRow() throws SQLException {
        throw new SQLFeatureNotSupportedException("moveToCurrentRow");
    }
    
    @Override
    public final boolean rowInserted() throws SQLException {
        throw new SQLFeatureNotSupportedException("rowInserted");
    }
    
    @Override
    public final boolean rowUpdated() throws SQLException {
        throw new SQLFeatureNotSupportedException("rowUpdated");
    }
    
    @Override
    public final boolean rowDeleted() throws SQLException {
        throw new SQLFeatureNotSupportedException("rowDeleted");
    }
    
    @Override
    public final String getCursorName() throws SQLException {
        throw new SQLFeatureNotSupportedException("getCursorName");
    }
    
    @Override
    public final int getHoldability() throws SQLException {
        throw new SQLFeatureNotSupportedException("getHoldability");
    }
    
    @Override

View on GitHub (pinned to e952770a21)

Solutions

  1. Detect external updates with an optimistic-locking column (version/updated_at) compared against your snapshot instead of rowUpdated()
  2. Track your own UPDATE statements in application state if the goal is to skip self-modified rows
  3. Audit shared iteration utilities for the row*Inserted/Updated/Deleted visibility calls before enabling federation

Example fix

// before
while (rs.next()) { if (rs.rowUpdated()) { refresh(rs); } }

// after
while (rs.next()) {
    if (rs.getLong("version") != snapshotVersion(rs.getLong("id"))) { refresh(rs); }
}
Defensive patterns

Strategy: try-catch

Validate before calling

try { rs.rowUpdated(); /* supported */ }
catch (final SQLFeatureNotSupportedException e) { /* visibility unsupported: compare version columns instead */ }

Type guard

private boolean isFederationVisibilitySupported(final ResultSet rs) {
    return rs.getClass().getName().startsWith("org.apache.shardingsphere.sqlfederation") == false;
}

Try / catch

boolean updated;
try { updated = rs.rowUpdated(); }
catch (final SQLFeatureNotSupportedException e) { updated = rs.getLong("version") > snapshotVersion(id); }

Prevention

When it happens

Trigger: Calling rs.rowUpdated() during iteration of a federated ResultSet — change-visibility branch logic such as if (rs.rowUpdated()) { reload row; }.

Common situations: Concurrency-aware GUIs or caches that refresh rows they detect as updated; code ported from drivers whose result sets support updates-visible semantics; enabling sql-federation on an existing ShardingSphere datasource and hitting this in shared iteration utilities.

Related errors


AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14). Data as JSON: /api/errors/7d604a9c4136edd6. Report an issue: GitHub.