Skip to content

MsSql: Stop reading statement keywords such as SET as implicit aliases - #2991

Open
colinhacks wants to merge 4 commits into
apache:mainfrom
colinhacks:mssql-set-begin-not-alias
Open

colinhacks wants to merge 4 commits into
apache:mainfrom
colinhacks:mssql-set-begin-not-alias

Conversation

@colinhacks

Copy link
Copy Markdown

Dialects: MsSql

With require_semicolon_stmt_delimiter = false, SELECT 1 followed by SET @x = 1 on the next line failed with Expected: an SQL statement, found: @x, because SET was read as an implicit alias of 1. BEGIN, OPEN, CLOSE, DEALLOCATE, GRANT, DENY, WAITFOR and KILL failed the same way after a select item, most of them after a table name too, and COMMIT, ROLLBACK and REVOKE were misread with no error: SELECT a FROM t followed by COMMIT came back as one statement, SELECT a FROM t COMMIT.

All of these are reserved keywords in T-SQL (https://learn.microsoft.com/en-us/sql/t-sql/language-elements/reserved-keywords-transact-sql), so they join the statement keywords MsSql already keeps out of aliases. USE is reserved too but stays out, since parse_select_table_with_index_hints expects SELECT * FROM T USE LIMIT 1 to read it as an alias in every dialect without table hints.

Written with an AI coding assistant.

Copilot AI balanced review requested due to automatic review settings November 17, 2026 18:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants