siwen-yu opened a new issue, #11729: URL: https://github.com/apache/seatunnel/issues/11729
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/seatunnel/issues) and found no similar issues. ### What happened When using JDBC connectors for databases that rely on the `MERGE ... WHEN MATCHED THEN UPDATE SET` upsert syntax (DM, Oracle, SAP HANA, SQL Server, Vertica, Xugu), upserting into a table whose **every column is a primary/unique key** (i.e. there is no non-key field to update) fails. The generated upsert SQL always appends `WHEN MATCHED THEN UPDATE SET <clause>`. When `updateSetClause` is empty, this produces invalid SQL (`UPDATE SET` with an empty body), and the database throws a syntax error, causing the job to fail. ### SeaTunnel Version 2.3.13 (and dev branch) ### Connector Name jdbc — dm, oracle, saphana, sqlserver, vertica, xugu ### What you expected to happen When there is nothing to update, the `WHEN MATCHED THEN UPDATE SET` clause should be omitted entirely, so the MERGE statement is valid and the job succeeds (matched rows are left unchanged, unmatched rows are inserted). ### How to reproduce 1. Create a table whose all columns are primary keys, e.g.: ```sql CREATE TABLE all_key_t (a INT PRIMARY KEY, b INT PRIMARY KEY); ``` 2. Configure a SeaTunnel JDBC sink (dm / oracle / saphana / sqlserver / vertica / xugu) with an upsert mode and run a job that writes/updates multiple rows. 3. Observe the SQL syntax error thrown by the database (empty `UPDATE SET`). ### Anything else A fix is provided in the linked PR. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
