GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing github.com — feat: support MERGE ... WHEN NOT MATCHED BY TARGET / BY SOURCE (#2421) by fudianchn · Pull Request #2453 · JSQLParser/JSqlParser Conversation
Contributor
ProblemBigQuery and SQL Server allow the MERGE INTO target_table AS tt USING (SELECT key, field FROM source_table) AS st ON tt.key = st.key WHEN NOT MATCHED BY TARGET THEN INSERT (key, field) VALUES (st.key, st.field) WHEN NOT MATCHED BY SOURCE THEN DELETE; The grammar's Change
Verification
Fixes #2421.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
BigQuery and SQL Server allow the MERGE NOT MATCHED clause to be
qualified with BY TARGET (allows INSERT) or BY SOURCE (allows
UPDATE/DELETE), e.g.:
MERGE INTO t USING s ON ...
WHEN NOT MATCHED BY TARGET THEN INSERT (...)
WHEN NOT MATCHED BY SOURCE THEN DELETE
Previously JSQLParser rejected the BY TARGET/BY SOURCE qualifier as an
UnsupportedStatement (JSQLParser#2421).
Add an optional [BY TARGET|SOURCE] to the WHEN NOT MATCHED production,
allow INSERT/update/delete on that branch, and store the side on the
MergeInsert/MergeUpdate/MergeDelete operations via a new MergeSide enum.
Standard WHEN [NOT] MATCHED (no BY) keeps working unchanged.
TARGET/SOURCE are matched as identifiers (not reserved keywords), so
existing SQL using them as column/table names is unaffected.
Fixes JSQLParser#2421
Signed-off-by: 付典 <[email protected]>
|
There was an error while loading. Please reload this page.
|
Run './gradlew spotlessApply' to fix all violations. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Run ./gradlew spotlessApply per review feedback. Pure formatting (Eclipse Google Style): line wrapping, Javadoc <p> placement, enum constant grouping. No logic changes. Signed-off-by: 付典 <[email protected]>
|
Thanks! I ran |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Very nice, thank you much for work and effort! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[BUG] BigQuery statement MERGE ... WHEN NOT MATCHED BY TARGET
There was an error while loading. Please reload this page.