-
Notifications
You must be signed in to change notification settings - Fork 690
Support @ symbol in column names with backticks and qualified syntax #2194
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
base: develop
Are you sure you want to change the base?
Conversation
…olumn names) Co-authored-by: mathiasrw <[email protected]>
Co-authored-by: mathiasrw <[email protected]>
| { $$ = new yy.Column({columnid: $3, tableid: $1});} | ||
| | Literal DOT VALUE | ||
| { $$ = new yy.Column({columnid: $3, tableid: $1});} | ||
| | Literal DOT AT Literal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this is the original intent? Is the point not to have @ in any part of the name?
also: how does it affect the current graph select notation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change on line 1184 adds support for qualified column references with @ (e.g., table.@column). This allows accessing JSON columns with @ when using table aliases. For unqualified references, backticks are still required (e.g., `@version`) to avoid conflicts with SQL Server variable syntax (@variable).
Regarding graph select notation: The AT Literal syntax used in graph selectors (lines 651-658) is preserved and unaffected. This change only adds a new alternative in the Column rule for qualified column names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the @ is in the middle of the name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backticks handle @ anywhere in the column name (beginning, middle, or end). Added test in commit 9c44576 demonstrating this:
`col@middle`✅ works`end@`✅ works`@start@end`✅ works
The BRALITERAL token (backticks) accepts any characters, so no grammar changes are needed for this case.
|
@copilot please run yarn jison $$ yarn test && yarn format |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: mathiasrw <[email protected]>
Completed in commit d6ddc0d:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot what if the @ is in the middle of the name? |
Co-authored-by: mathiasrw <[email protected]>
Backticks handle
The |
Description
Adds support for JSON column names containing the
@symbol using backticks or qualified column syntax. This allows querying JSON documents with@in column names (at the beginning, middle, or end) while maintaining backward compatibility with SQL Server variable syntax.Changes Made
alasqlparser.jisonto addLiteral DOT AT Literalrule in the Column production, enabling qualified column references liket.@versiontest884.jswith comprehensive tests for@symbol handling in column namesalasqlparser.jsusing jisonUsage
For JSON columns with
@symbol, use one of these approaches:@anywhere in name):SELECT `@version`, `col@middle`, `end@` FROM ?@at start with table alias):SELECT t.@version FROM ? AS tThe unqualified syntax without backticks (
SELECT @version FROM ?) is not supported to avoid conflicts with SQL Server variable syntax (@variable).Testing
@columns (beginning of name)table.@column)@columns@in middle or end of column names with backticksNotes
This implementation balances support for JSON column names with
@while preserving existing SQL Server variable functionality (DECLARE @var,SET @var,SELECT @var). Backticks (`) provide the most flexible approach, supporting@at any position in the column name.Fixes #884
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.