Repository navigation
Conversation
PostgreSQL allows almost any keyword (SELECT, ANALYZE, LATERAL, AND, OR, COLLATE, ...) to be used as a bare (AS-less) column alias unless it is in a small set of keywords that require a leading AS. See https://www.postgresql.org/docs/current/sql-keywords-appendix.html Previously: SELECT (SELECT c FROM tbl_name LIMIT 1) select; failed to parse.
907398c to
0de43ef
Compare
|
I also tested directly on pg the aliases in the tests @LucaCappelletti94 . |
…rd-column-alias # Conflicts: # tests/sqlparser_postgres.rs
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2491 +/- ##
=======================================
Coverage 81.09% 81.10%
=======================================
Files 42 42
Lines 33684 33700 +16
Branches 33684 33700 +16
=======================================
+ Hits 27316 27332 +16
Misses 2798 2798
Partials 3570 3570 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
LucaCappelletti94
left a comment
There was a problem hiding this comment.
Snowflake's is_column_alias returns true for any keyword not in its own list, so the new loop break accepts SELECT 1 AND and SELECT 1 OR. Snowflake reserves both (reserved keywords).
Do extend the keyword list, and add the necessary tests for them.
- Keyword::FROM
+ Keyword::AND
+ | Keyword::FROM
| Keyword::GROUP
| Keyword::HAVING
| Keyword::INTERSECT
| Keyword::INTO
| Keyword::MINUS
+ | Keyword::OR
| Keyword::ORDER
LucaCappelletti94
left a comment
There was a problem hiding this comment.
The branch conflicts with main, and after I merged it locally three tests fail. Please rebase and resolve these regressions.
PostgreSQL allows almost any keyword (SELECT, ANALYZE, LATERAL, AND, OR, COLLATE, ...) to be used as a bare (AS-less) column alias unless it is in a small set of keywords that require a leading AS.
See https://www.postgresql.org/docs/current/sql-keywords-appendix.html
Previously:
SELECT (SELECT c FROM tbl_name LIMIT 1) select;(or analyze/lateral/and/or/collate)
failed to parse.
This PR fixes that