-
Notifications
You must be signed in to change notification settings - Fork 601
fix: Handle double quotes inside quoted identifiers correctly #411
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
Changes from 1 commit
113722e
96e695f
e344aac
f85c399
2c9cd20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -834,6 +834,11 @@ fn parse_comments() { | |
} | ||
} | ||
|
||
#[test] | ||
fn parse_quoted_identifier() { | ||
pg_and_generic().verified_stmt(r#"SELECT "quoted "" ident""#); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perhaps we can add a test for dialects (e.g. mysql) that this isn't parsed as an identifier? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a test for ` quoted strings in mysql |
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is definitely how postgres handles things alamb=# SELECT "quoted "" ident" from t1;
ERROR: column "quoted " ident" does not exist
LINE 1: SELECT "quoted "" ident" from t1;
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. However, msql treats this differently Database changed
mysql> SELECT "quoted "" ident" from t1;
+----------------+
| quoted " ident |
+----------------+
| quoted " ident |
| quoted " ident |
| quoted " ident |
| quoted " ident |
| quoted " ident |
+----------------+
5 rows in set (0.00 sec)
mysql> SELECT "quoted ident" from t1;
+---------------+
| quoted ident |
+---------------+
| quoted ident |
| quoted ident |
| quoted ident |
| quoted ident |
| quoted ident |
+---------------+
5 rows in set (0.00 sec)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
fn pg() -> TestedDialects { | ||
TestedDialects { | ||
dialects: vec![Box::new(PostgreSqlDialect {})], | ||
|
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.
I think this code would be easier to understand if it were pulled out into its own function (
peeking_take_while_ident
?) which could be unit tested, to ensure it handles cases such as