iffyio commented on code in PR #1662:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1662#discussion_r1919873394


##########
src/parser/mod.rs:
##########
@@ -14578,4 +14584,26 @@ mod tests {
 
         assert!(Parser::parse_sql(&MySqlDialect {}, sql).is_err());
     }
+
+    #[test]
+    fn test_keyword() {
+        let sql = "select * from t where user = 'test';";

Review Comment:
   oh actually the problem being solved isn't currently clear to me, my 
understanding is that in postgres for example, given this statement, `user` is 
indeed a function. What's the undesirable behavior being solved for by this PR?



##########
src/ast/mod.rs:
##########
@@ -5807,6 +5807,11 @@ pub struct Function {
     /// <aggregate_function>(expression) WITHIN GROUP (ORDER BY key [ASC | 
DESC], ...)
     /// ```
     pub within_group: Vec<OrderByExpr>,
+
+    /// Sometimes function names may also be column names,
+    /// for example, user, current_user,
+    /// it requires the user to determine whether it is a column name or a 
function name.
+    pub maybe_column: bool,

Review Comment:
   I think the desired behavior is that the keywords `USER`, `CURRENT_USER` etc 
are represented as identifiers in the scenarios where they are not functions. 
Having a flag on the function saying that the flag is in fact not a function 
sounds like it would be misleading/confusing behavior to the user



-- 
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.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to