MSSQL: Add support for OUTPUT clause on INSERT/UPDATE/DELETE#2228
Open
guan404ming wants to merge 1 commit intoapache:mainfrom
Open
MSSQL: Add support for OUTPUT clause on INSERT/UPDATE/DELETE#2228guan404ming wants to merge 1 commit intoapache:mainfrom
guan404ming wants to merge 1 commit intoapache:mainfrom
Conversation
Signed-off-by: Guan-Ming Chiu <guanmingchiu@gmail.com>
iffyio
reviewed
Feb 24, 2026
| pub on: Option<OnInsert>, | ||
| /// RETURNING | ||
| pub returning: Option<Vec<SelectItem>>, | ||
| /// OUTPUT (MSSQL) |
Contributor
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
Comment on lines
+13292
to
+13293
| // MSSQL OUTPUT clause appears after FROM table, before USING/WHERE | ||
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql |
Contributor
There was a problem hiding this comment.
Suggested change
| // MSSQL OUTPUT clause appears after FROM table, before USING/WHERE | |
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql |
Comment on lines
+17271
to
+17272
| // MSSQL OUTPUT clause appears between columns and source | ||
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql |
Contributor
There was a problem hiding this comment.
Suggested change
| // MSSQL OUTPUT clause appears between columns and source | |
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql |
Comment on lines
+17505
to
+17506
| // MSSQL OUTPUT clause appears after SET, before FROM/WHERE | ||
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql |
Contributor
There was a problem hiding this comment.
Suggested change
| // 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?
Comment on lines
+2734
to
+2736
| // MSSQL OUTPUT clause on INSERT/UPDATE/DELETE | ||
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql | ||
|
|
Contributor
There was a problem hiding this comment.
Suggested change
| // MSSQL OUTPUT clause on INSERT/UPDATE/DELETE | |
| // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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