{"record":{"id":"8bfb3cb931b18da3","repo":"apache/seatunnel","slug":"the-delete-table-is-not-equal-to-the-target-tab","errorCode":null,"errorMessage":"The delete table {} is not equal to the target table {}","messagePattern":"The delete table (.+?) is not equal to the target table (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/catalog/IcebergCatalog.java","lineNumber":241,"sourceCode":"\n    @Override\n    public void executeSql(TablePath tablePath, String sql) {\n        Delete delete;\n        try {\n            Statement statement = CCJSqlParserUtil.parse(sql);\n            delete = (Delete) statement;\n        } catch (Throwable e) {\n            throw new IllegalArgumentException(\n                    \"Only support sql: delete from ... where ..., Not support: \" + sql, e);\n        }\n\n        TablePath targetTablePath = TablePath.of(delete.getTable().getFullyQualifiedName(), false);\n        if (targetTablePath.getDatabaseName() == null) {\n            targetTablePath =\n                    TablePath.of(tablePath.getDatabaseName(), targetTablePath.getTableName());\n        }\n        if (!targetTablePath.equals(tablePath)) {\n            log.warn(\n                    \"The delete table {} is not equal to the target table {}\",\n                    targetTablePath,\n                    tablePath);\n        }\n\n        TableIdentifier icebergTableIdentifier = toIcebergTableIdentifier(targetTablePath);\n        Table table = catalog.loadTable(icebergTableIdentifier);\n        Expression expression = ExpressionUtils.convert(delete.getWhere(), table.schema());\n        catalog.loadTable(icebergTableIdentifier)\n                .newDelete()\n                .deleteFromRowFilter(expression)\n                .commit();\n        log.info(\n                \"Delete table {} data success, sql [{}] to deleteFromRowFilter: {}\",\n                targetTablePath,\n                sql,\n                expression);\n    }","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/catalog/IcebergCatalog.java#L223-L259","documentation":"This warning is logged by the Iceberg catalog's executeSql when a DELETE statement's table path does not match the target table path the SQL was applied against. The library only warns (does not fail) because it already resolved the delete target from the statement; a mismatch signals the delete may be applied against an unexpected table identity, e.g. a fully-qualified name whose database differs from the connection's tablePath. It exists to surface potentially mis-scoped DELETE operations in mixed-catalog or default-database setups.","triggerScenarios":"Calling catalog.executeSql(...) with a SQL DELETE whose table reference (delete.getTable().getFullyQualifiedName()) resolves to a TablePath different from the tablePath argument, typically when the delete statement omits or uses a different database qualifier than the target tablePath.","commonSituations":"Running DELETE FROM tableName without a database prefix while the connection targets a different database; case-sensitivity or catalog-name prefix differences (e.g. 'catalog.db.table' vs 'db.table'); copying SQL from another environment pointing at a stale database.","solutions":["Include the exact database qualifier in the DELETE statement so it matches the target tablePath (e.g. DELETE FROM mydb.mytable ...)","Verify the tablePath passed to executeSql matches the fully-qualified name in the SQL (same database and table, case-sensitive)","If the mismatch is intentional (default-database resolution), ignore the warning or qualify the name to silence it","Check TablePath.of(..., false) normalization: ensure no catalog prefix leaks into the parsed name"],"exampleFix":"// before\ncatalog.executeSql(tablePath, \"DELETE FROM mytable WHERE id < 100\");\n// after\ncatalog.executeSql(tablePath, \"DELETE FROM mydb.mytable WHERE id < 100\");","handlingStrategy":"validation","validationCode":"TablePath deletePath = TablePath.of(delete.getTable().getFullyQualifiedName(), false);\nif (deletePath.getDatabaseName() == null) {\n    deletePath = TablePath.of(tablePath.getDatabaseName(), deletePath.getTableName());\n}\nif (!deletePath.equals(tablePath)) {\n    throw new IllegalArgumentException(\"DELETE target \" + deletePath + \" != target table \" + tablePath);\n}","typeGuard":"boolean deleteTargetsSameTable(Delete delete, TablePath tablePath) {\n    TablePath p = TablePath.of(delete.getTable().getFullyQualifiedName(), false);\n    if (p.getDatabaseName() == null) p = TablePath.of(tablePath.getDatabaseName(), p.getTableName());\n    return p.equals(tablePath);\n}","tryCatchPattern":null,"preventionTips":["Always fully qualify the table name in DELETE SQL with the same database as tablePath","Keep tablePath and SQL text generated from one source of truth","Log/assert target equality in integration tests for DELETE pipelines"],"tags":["iceberg","catalog","sql-delete","table-path-mismatch"],"backgroundTag":"invalid-argument-value","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}