zhang-arvin opened a new pull request, #11861: URL: https://github.com/apache/seatunnel/pull/11861
## Purpose of this pull request Fix the MERGE (upsert) SQL generation in JDBC dialects for tables whose every column is a primary/unique key (i.e. no non-key field to update). Previously `getUpsertStatement` always appended `WHEN MATCHED THEN UPDATE SET <clause>`; when `updateSetClause` is empty this yielded invalid SQL (`UPDATE SET` with an empty body) and the database threw a syntax error. Affected dialects: DM, Oracle, SAP HANA, SQL Server, Vertica, Xugu. This PR introduces a `matchedClause` string that is omitted entirely when there is nothing to update. When `updateSetClause` is non-empty, the behavior is identical to before. Closes #11729 ## Does this PR introduce any user-facing change? Yes (bug fix, no API/config/schema change). - Before: upserting into an all-key table via the above dialects failed with a SQL syntax error (empty `UPDATE SET` body). - After: the MERGE statement is generated correctly; matched rows are left unchanged and unmatched rows inserted, so the job succeeds. ## How was this patch tested? - Added regression test in `VerticaDialectTest` covering the all-key table scenario - Ran `./mvnw test -pl seatunnel-connectors-v2/connector-jdbc -Dtest=VerticaDialectTest` - all tests pass ## Check list - [x] No new Jar binary package added - [ ] Documentation update — not needed (internal SQL generation fix) - [ ] incompatible-changes.md — not needed (backward compatible) - [ ] Connector checklist — not applicable, no new connector added -- 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]
