maropu commented on a change in pull request #23880: [SPARK-26976][SQL] Forbid 
reserved keywords as table identifiers when ANSI mode is on
URL: https://github.com/apache/spark/pull/23880#discussion_r264632927
 
 

 ##########
 File path: 
sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
 ##########
 @@ -736,7 +741,6 @@ qualifiedName
 
 identifier
     : strictIdentifier
-    | {ansi}? ansiReserved
 
 Review comment:
   yeah, it seems `current_timestamp()` is not a topic of the ANSI standard. 
So, I'll drop it in this pr.
   
   But, some databases support `current_timestamp()` and this is 
implementation-specific.
   For example, postgresql/oracle support `current_timestamp(precision)` as 
follows;
   ```
   postgres=# select CURRENT_TIMESTAMP;
                 now              
   -------------------------------
    2019-03-12 20:22:52.065108+09
   (1 row)
   
   postgres=# select CURRENT_TIMESTAMP(1);
          timestamptz        
   --------------------------
    2019-03-12 20:22:56.2+09
   (1 row)
   
   postgres=# select CURRENT_TIMESTAMP();
   ERROR:  syntax error at or near ")" at character 26
   STATEMENT:  select CURRENT_TIMESTAMP();
   ERROR:  syntax error at or near ")"
   LINE 1: select CURRENT_TIMESTAMP();
                                    ^
   ```
   So, it might be worth supporting this function for better portability even 
when ansi mode enabled (this is future work though...).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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]

Reply via email to