MSSQL: Add support for functionality MERGE output clause (#1790)

This commit is contained in:
DilovanCelik 2025-04-05 18:37:28 +00:00 committed by GitHub
parent 3ed4ad9c66
commit 610096cad8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 109 additions and 16 deletions

View file

@ -9359,6 +9359,7 @@ fn parse_merge() {
source,
on,
clauses,
..
},
Statement::Merge {
into: no_into,
@ -9366,6 +9367,7 @@ fn parse_merge() {
source: source_no_into,
on: on_no_into,
clauses: clauses_no_into,
..
},
) => {
assert!(into);
@ -9558,6 +9560,19 @@ fn parse_merge() {
verified_stmt(sql);
}
#[test]
fn test_merge_with_output() {
let sql = "MERGE INTO target_table USING source_table \
ON target_table.id = source_table.oooid \
WHEN MATCHED THEN \
UPDATE SET target_table.description = source_table.description \
WHEN NOT MATCHED THEN \
INSERT (ID, description) VALUES (source_table.id, source_table.description) \
OUTPUT inserted.* INTO log_target";
verified_stmt(sql);
}
#[test]
fn test_merge_into_using_table() {
let sql = "MERGE INTO target_table USING source_table \