WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@yoavcloud
Copy link
Contributor

When parsing a SQL that doesn't use semicolon delimiters, for example:

SELECT col FROM tbl
IF x=1
  SELECT 1
ELSE
  SELECT 2

The parser needs to identify the IF keyword as a new statement instead of an alias for tbl and the ELSE as part of the conditional statement instead of an alias to 1. Moreover, MSSQL doesn't support IF/ELSE as explicit (after AS) or implicit table or column aliases.

Removed the assumption that every keyword after AS is an alias, and extended MSSQL to exclude IF/ELSE as alias.

Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @yoavcloud!

@iffyio iffyio added this pull request to the merge queue Dec 10, 2025
Merged via the queue into apache:main with commit 1b842d3 Dec 10, 2025
10 checks passed
@yoavcloud yoavcloud deleted the mssql_if_else_no_semicolon branch December 10, 2025 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants