MSSQL: Add support for OUTPUT clause on INSERT/UPDATE/DELETE#2228
MSSQL: Add support for OUTPUT clause on INSERT/UPDATE/DELETE#2228iffyio merged 2 commits intoapache:mainfrom
Conversation
| pub on: Option<OnInsert>, | ||
| /// RETURNING | ||
| pub returning: Option<Vec<SelectItem>>, | ||
| /// OUTPUT (MSSQL) |
There was a problem hiding this comment.
for these comments, could we include the link to the mssql docs describing the syntax? it would help with nagivation when folks look at the struct
There was a problem hiding this comment.
Sure, that makes sense and just added.
src/parser/mod.rs
Outdated
| // MSSQL OUTPUT clause appears after FROM table, before USING/WHERE | ||
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql |
There was a problem hiding this comment.
| // MSSQL OUTPUT clause appears after FROM table, before USING/WHERE | |
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql |
src/parser/mod.rs
Outdated
| // MSSQL OUTPUT clause appears between columns and source | ||
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql |
There was a problem hiding this comment.
| // MSSQL OUTPUT clause appears between columns and source | |
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql |
src/parser/mod.rs
Outdated
| // MSSQL OUTPUT clause appears after SET, before FROM/WHERE | ||
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql |
There was a problem hiding this comment.
| // MSSQL OUTPUT clause appears after SET, before FROM/WHERE | |
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql |
maybe we can introduce a helper function maybe_parse_output_clause() that can be called from the relevant statement parsing functions?
There was a problem hiding this comment.
Yes, that would be better. Thanks, just updated!
tests/sqlparser_mssql.rs
Outdated
| // MSSQL OUTPUT clause on INSERT/UPDATE/DELETE | ||
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql | ||
|
|
There was a problem hiding this comment.
| // MSSQL OUTPUT clause on INSERT/UPDATE/DELETE | |
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql |
5671dae to
02033ab
Compare
|
@guan404ming could you resolve the conflicts on the branch when you get the chance? |
Signed-off-by: Guan-Ming Chiu <guanmingchiu@gmail.com>
02033ab to
1634386
Compare
Yeah sure, just updated. Thanks! |
iffyio
left a comment
There was a problem hiding this comment.
LGTM! Thanks @guan404ming!
|
Thanks for your review! |
Why
MSSQL's OUTPUT clause allows returning inserted/deleted column values from DML statements, but was only supported on MERGE.
How
OUTPUTandVALUESkeywords for table/column alias contexts to prevent ambiguous parsingOUTPUTwith and withoutINTOon all three statement types