{"record":{"id":"af48dc3528975c3e","repo":"apache/shardingsphere","slug":"rowinserted-af48dc","errorCode":null,"errorMessage":"rowInserted","messagePattern":"rowInserted","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java","lineNumber":130,"sourceCode":"    \n    @Override\n    public final void cancelRowUpdates() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"cancelRowUpdates\");\n    }\n    \n    @Override\n    public final void moveToInsertRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"moveToInsertRow\");\n    }\n    \n    @Override\n    public final void moveToCurrentRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"moveToCurrentRow\");\n    }\n    \n    @Override\n    public final boolean rowInserted() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"rowInserted\");\n    }\n    \n    @Override\n    public final boolean rowUpdated() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"rowUpdated\");\n    }\n    \n    @Override\n    public final boolean rowDeleted() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"rowDeleted\");\n    }\n    \n    @Override\n    public final String getCursorName() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getCursorName\");\n    }\n    \n    @Override","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java#L112-L148","documentation":"rowInserted() — reporting whether the current row was inserted via the ResultSet insert-row — throws SQLFeatureNotSupportedException in the federation ResultSet. Because inserts through the cursor are unsupported, visibility-of-inserts queries are also unsupported; the method is final and rejects every call.","triggerScenarios":"Calling rs.rowInserted() while iterating a federated ResultSet, e.g. change-detection loops that branch on rowInserted()/rowUpdated()/rowDeleted() visibility flags.","commonSituations":"Sync/ETL code that distinguishes own-cursor changes from external changes using the JDBC visibility methods; ported code that assumes default JDBC visibility behavior (inserts visible = false at minimum per spec) instead of handling the exception; running such loops against ShardingSphere federation for the first time.","solutions":["Remove visibility checks: track which rows your own code inserted/updated/deleted in application state","If detecting external concurrent changes, use a version/timestamp column or CHANGE detection query instead of rowInserted()","Wrap third-party code you cannot change so federation connections are not passed to visibility-check loops"],"exampleFix":"// before\nwhile (rs.next()) { if (rs.rowInserted()) continue; ... }\n\n// after\nSet<Long> insertedIds = ...; // tracked by your code\nwhile (rs.next()) { if (insertedIds.contains(rs.getLong(\"id\"))) continue; ... }","handlingStrategy":"try-catch","validationCode":"try { rs.rowInserted(); /* supported */ }\ncatch (final SQLFeatureNotSupportedException e) { /* visibility unsupported: track own inserts in a Set */ }","typeGuard":"private boolean isFederationVisibilitySupported(final ResultSet rs) {\n    return rs.getClass().getName().startsWith(\"org.apache.shardingsphere.sqlfederation\") == false;\n}","tryCatchPattern":"boolean inserted;\ntry { inserted = rs.rowInserted(); }\ncatch (final SQLFeatureNotSupportedException e) { inserted = ownInsertedIds.contains(id); }","preventionTips":["Track own mutations in application state","Never branch on visibility flags for federation reads","Wrap change-detection loops in capability-aware helpers"],"tags":["jdbc","resultset","sql-federation","visibility","shardingsphere"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}