You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "Y-sir (via GitHub)" <gi...@apache.org> on 2024/04/23 09:33:53 UTC

[I] Postgresql keyword syntax parsing error problem [shardingsphere]

Y-sir opened a new issue, #30993:
URL: https://github.com/apache/shardingsphere/issues/30993

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   5.5.0 
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy   postgresql
   ### Expected behavior
   All fields can be queried
   renderings:
   ![image](https://github.com/apache/shardingsphere/assets/62044303/850685dd-9ce6-4eef-a12b-c420ad811fe2)
   
   ### Actual behavior
   In fact, the grammar does not support
   renderings:
   ![image](https://github.com/apache/shardingsphere/assets/62044303/2ef603e7-e6e3-4553-8446-ed2849fed9e2)
   
   ### Reason analyze (If you can)
   The problem with these two fields as aliases
   'CONSTRAINT' And 'COLLATION' The problem with these two keywords;
   I put this statement into the ANTLR tool and executed it, but it could not be parsed;
   renderings:
   ![image](https://github.com/apache/shardingsphere/assets/62044303/8dc4fcd0-1735-4366-888f-7662f51e319e)
   Now replace these two keywords with other words and try to execute it;
   I added an A after these two words;  You can see that it is parsed normally;
   renderings:
   ![image](https://github.com/apache/shardingsphere/assets/62044303/909e0026-83ae-4fcd-82b1-8fd1ce767a8a)
   
   Now put the sql statement with A added into shardingproxy and execute it. OK, you can see that it can be executed.
   renderings:
   ![image](https://github.com/apache/shardingsphere/assets/62044303/a97e40cb-da8e-4102-922e-1f78ef83a178)
   Now it can be determined that the problem is indeed caused by these two keywords;
   
   You might say, wouldn't it be enough if you don't use these two keywords as aliases? But this sql was not sent by me, but the sql triggered by Navicat when I right-clicked the query table structure.
   renderings:
   ![image](https://github.com/apache/shardingsphere/assets/62044303/23e072b3-0bb3-48bf-bf69-b94e58c6e5ed)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   sql:
   `SELECT ci.relname AS index_name, con.conname,
   i.indexrelid AS oid,
   ct.relname AS TABLE_NAME,
   i.indrelid AS table_oid,
   am.amname AS index_type,
   i.indisunique AS is_unique,
   i.indisclustered AS is_clustered,
   i.indisprimary AS is_primary,
   pg_get_expr ( indpred, indrelid, TRUE ) AS CONSTRAINT,
   ts.spcname AS tablespace_name,
   pa.rolname AS OWNER,
   ci.reloptions,
   i.indkey,
   i.indclass,
   i.indnatts,
   i.indoption,
   i.indcollation AS COLLATION,
   ci.relpages AS index_pages,
   obj_description ( indexrelid ) AS COMMENT 
   FROM
   pg_index i
   LEFT JOIN pg_class ct ON ct.oid = i.indrelid
   LEFT JOIN pg_class ci ON ci.oid = i.indexrelid
   LEFT JOIN pg_namespace tns ON tns.oid = ct.relnamespace
   LEFT JOIN pg_namespace ins ON ins.oid = ci.relnamespace
   LEFT JOIN pg_tablespace ts ON ci.reltablespace = ts.oid
   LEFT JOIN pg_am am ON ci.relam = am.oid
   LEFT JOIN pg_depend dep ON dep.classid = ci.tableoid 
   AND dep.objid = ci.oid 
   AND dep.refobjsubid = '0'
   LEFT JOIN pg_constraint con ON con.tableoid = dep.refclassid 
   AND con.oid = dep.refobjid
   LEFT JOIN pg_roles pa ON pa.oid = ci.relowner 
   WHERE
   ins.nspname = 'public' AND conname IS NULL AND ct.relname = 't11' ORDER BY ct.relname,ins.nspname,ci.relname`
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

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


Re: [I] Postgresql keyword syntax parsing error problem [shardingsphere]

Posted by "TherChenYang (via GitHub)" <gi...@apache.org>.
TherChenYang commented on issue #30993:
URL: https://github.com/apache/shardingsphere/issues/30993#issuecomment-2079402238

   @Y-sir Thank you for your feedback, I have checked the corresponding parsing file and made adjustments.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


Re: [I] Postgresql keyword syntax parsing error problem [shardingsphere]

Posted by "Y-sir (via GitHub)" <gi...@apache.org>.
Y-sir commented on issue #30993:
URL: https://github.com/apache/shardingsphere/issues/30993#issuecomment-2081301183

   @TherChenYang Thanks


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


Re: [I] Postgresql keyword syntax parsing error problem [shardingsphere]

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu closed issue #30993: Postgresql keyword syntax parsing error problem
URL: https://github.com/apache/shardingsphere/issues/30993


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


Re: [I] Postgresql keyword syntax parsing error problem [shardingsphere]

Posted by "Y-sir (via GitHub)" <gi...@apache.org>.
Y-sir commented on issue #30993:
URL: https://github.com/apache/shardingsphere/issues/30993#issuecomment-2071861634

   @TherChenYang 


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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