mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-21 22:44:08 +00:00
MSSQL: Add support for functionality MERGE
output clause (#1790)
This commit is contained in:
parent
3ed4ad9c66
commit
610096cad8
7 changed files with 109 additions and 16 deletions
|
@ -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 \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue