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

   
   • Issue Understanding
   
     - On ShardingSphere-Proxy (PostgreSQL protocol) 5.3.1-SNAPSHOT, Navicat 16 
fails to view table structure: the trigger metadata query Navicat sends 
triggers an NPE during SQL parsing (visitColumnref). Sending the same SQL via 
JDBC reproduces the NPE.
   
     Root Cause
   
     - The 5.3.1-SNAPSHOT PostgreSQL SQLVisitor assumes indirectionEl() always 
has attrName() and does not handle [] subscripts or .*. When parsing rm.m[1] 
from Navicat’s query, attrName() is null and an NPE occurs.
   
     Analysis
   
     - PostgreSQL allows colId indirection with .attr, .*, or [expr]. Navicat’s 
query includes SELECT rm.m[1] AS m FROM regexp_matches(...) rm(m), which uses a 
subscript. In 5.3.1-SNAPSHOT, visitColumnref lacks a null check for 
non-attrName indirections, so the NPE is
       guaranteed. Current main code in 
parser/sql/engine/dialect/postgresql/src/main/java/org/apache/shardingsphere/sql/parser/engine/postgresql/visitor/statement/PostgreSQLStatementVisitor.java
 has added the attrName null guard, preventing the crash.
   
     Conclusion
   
     - This is a known parser defect in the old snapshot. Upgrade to the latest 
release or latest snapshot where visitColumnref handles non-attrName 
indirections. If the issue persists on the latest version, please provide the 
exact version, Proxy config, the full SQL used,
       and the complete stack trace for further triage.


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