terrymanu commented on issue #29692:
URL: 
https://github.com/apache/shardingsphere/issues/29692#issuecomment-3532224566

   Based on my detailed analysis of GitHub issue #29692, here are my findings 
and conclusions:
   
     🔍 Problem Understanding
   
     The user reported encountering a parsing error when using the following 
SQL statement in ShardingSphere version 5.2.1:
     insert into t_entry_exit_record(id,exit_report_time) 
values(?,COALESCE(?,CURRENT_TIMESTAMP()))
   
     Error message: 
org.apache.shardingsphere.sql.parser.exception.SQLParsingException
   
     The user discovered that using IFNULL works normally, but COALESCE cannot 
be parsed.
   
     🎯 Root Cause Analysis
   
     After in-depth analysis of the current master branch code, I found that:
   
     1. COALESCE Function is Supported:
       - COALESCE is explicitly defined as a keyword in MySQL dialect (in 
MySQLKeyword.g4)
       - COALESCE is included in unreservedWord, so it can be used as an 
identifier
       - Test cases show that COALESCE can be parsed and used normally in 
SELECT statements
     2. CURRENT_TIMESTAMP Function is Supported:
       - CURRENT_TIMESTAMP is explicitly defined in shorthandRegularFunction
       - Both parameterized and parameter-less forms are supported
     3. Syntax Structure Support:
       - regularFunction -> completeRegularFunction -> regularFunctionName -> 
identifier
       - This parsing chain is complete and correct
     4. Verification Tests Pass:
       - Running MySQL parser integration tests, all 1721 tests pass
       - This indicates that the current SQL parser works normally
   
     💡 Core Conclusion
   
     This is an issue that existed in version 5.2.1 but has been fixed in the 
current master version.
   
     📋 Recommended Solution
   
     Upgrade to the latest ShardingSphere master version or the upcoming 5.5.3 
version
   
     The current code fully supports the use of COALESCE function in INSERT 
statements. The user's issue has been resolved in the latest version.
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to