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

TSql Add rule and keyword for LABEL in OPTIONS of table #3459

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AKryukov92
Copy link
Contributor

No description provided.

@KvanTTT KvanTTT added the tsql label May 22, 2023
Copy link
Member

@KvanTTT KvanTTT left a comment

Choose a reason for hiding this comment

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

Please cover suggested changed by an example.

@@ -527,6 +527,7 @@ KEY_PATH: 'KEY_PATH';
KEY_SOURCE: 'KEY_SOURCE';
KEY_STORE_PROVIDER_NAME: 'KEY_STORE_PROVIDER_NAME';
KILL: 'KILL';
LABEL: 'LABEL';
Copy link
Member

Choose a reason for hiding this comment

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

Can LABEL be identifier? I guess so that why add this token to keyword list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to
https://learn.microsoft.com/en-us/sql/t-sql/language-elements/reserved-keywords-transact-sql?view=azuresqldb-current
LABEL is a keyword in Azure Synapse Analytics, which is tsql dialect too.
I'll remove this keyword here because those rules are general purpose

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I add only rule in parser without keyword here, then on parsing

select whatever from tbl OPTION (MAXDOP 1, LABEL = 'Large');

it will throw errors:

mismatched input ',' expecting '.'
mismatched input 'OPTION' expecting '.'
mismatched input 'LABEL' expecting {'CONCAT', 'EXPAND', 'FAST', 'FORCE', 'HASH', 'IGNORE_NONCLUSTERED_COLUMNSTORE_INDEX', 'KEEP', 'KEEPFIXED', 'LOOP', 'MAXDOP', 'MAXRECURSION', 'MERGE', 'OPTIMIZE', 'ORDER', 'PARAMETRIZATION', 'RECOMPILE', 'ROBUST', 'USE', LABEL}

Is there any other way to support this syntax?

Copy link
Member

Choose a reason for hiding this comment

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

I didn't mean adding the rule only to parser. I meant adding both token as you did at the beginning:

LABEL:                                 'LABEL';

and to keyword list:

keyword
    ...
    | LABEL
    ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants