Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APPLY not recognised as a keyword #102

Open
AntoniKedzierski opened this issue Jul 11, 2022 · 2 comments
Open

APPLY not recognised as a keyword #102

AntoniKedzierski opened this issue Jul 11, 2022 · 2 comments
Assignees

Comments

@AntoniKedzierski
Copy link

Consider the following T-SQL statement:
SELECT * FROM Foo CROSS APPLY ( SELECT * FROM Bar ) ca

The parser returns tokens:
obraz

'APPLY' is mistakenly considered as an identifier instead of the T-SQL keyword.

BR
Antoni

@bruce-dunwiddie
Copy link
Owner

Ok. Thank you for letting me know. I will take a look and get back with an update within a few days.

@bruce-dunwiddie bruce-dunwiddie self-assigned this Jul 11, 2022
@bruce-dunwiddie bruce-dunwiddie added the under review Attempting to verify and confirm bug label Jul 11, 2022
@bruce-dunwiddie
Copy link
Owner

I'm going to classify this as something for possible future consideration as an enhancement, and I'll explain why.

APPLY is not officially recognized as a keyword of T-SQL (https://docs.microsoft.com/en-us/sql/t-sql/language-elements/reserved-keywords-transact-sql), nor any of the main SQL standards (https://en.wikipedia.org/wiki/SQL_reserved_words), including the latest revision of ANSI SQL.

The parser does also maintain a list of "future" reserved words, for somewhat similar problematic parsing situations, e.g. OUTPUT, but those words generally exist on at least one of the reserved words lists already.

I do understand (exceptionally well considering some of the more advanced statement parsing logic I've been adding to the library, along with logic within dependent libraries, e.g. https://github.com/bruce-dunwiddie/tsql-color and https://github.com/bruce-dunwiddie/tsql-depends) how this might make some more advanced parsing logic that you're probably trying to implement more complicated and problematic.

Part of the challenge in maintaining this library is finding the best balance between ease of use, and matching an official spec, so I put considerable thought into some choices when there's no obvious correct decision. And even then I sometimes have to back out of what I previously thought was a good decision.

@bruce-dunwiddie bruce-dunwiddie added enhancement and removed under review Attempting to verify and confirm bug labels Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants