maropu commented on a change in pull request #23259: [SPARK-26215][SQL] Define
reserved/non-reserved keywords based on the ANSI SQL standard
URL: https://github.com/apache/spark/pull/23259#discussion_r258914082
##########
File path:
sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
##########
@@ -720,14 +725,18 @@ qualifiedName
identifier
: strictIdentifier
+ // We can't move the tokens below into `strictIdentifier` because we need
to parse some SQL texts,
+ // e.g., SELECT * FROM t1 CROSS JOIN t2
| ANTI | FULL | INNER | LEFT | SEMI | RIGHT | NATURAL | JOIN | CROSS | ON
| UNION | INTERSECT | EXCEPT | SETMINUS
;
strictIdentifier
- : IDENTIFIER #unquotedIdentifier
- | quotedIdentifier #quotedIdentifierAlternative
- | nonReserved #unquotedIdentifier
+ : IDENTIFIER #unquotedIdentifier
+ | quotedIdentifier #quotedIdentifierAlternative
+ | {ansi}? ansiReserved #unquotedIdentifier
Review comment:
Aha, I see. If so, looks ok to me. I just follow the PostgreSQL behaivour;
```
postgres=# select * from t select;
ERROR: syntax error at or near "select" at character 17
STATEMENT: select * from t select;
ERROR: syntax error at or near "select"
LINE 1: select * from t select;
```
In the pg, we cannot use reserved keywords in a table alias.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]