You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/10/15 16:28:17 UTC

[GitHub] [shardingsphere] strongduanmu opened a new issue, #21594: Wrong SQL rewrite result occurs when part of logical table name of the binding table is consistent with the actual table name, and some are inconsistent

strongduanmu opened a new issue, #21594:
URL: https://github.com/apache/shardingsphere/issues/21594

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   https://github.com/apache/shardingsphere/commit/155b86e7ff8d7b247e0261c2b9135059bb12ccca
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   SQL rewrite successfully.
   
   ### Actual behavior
   
   ![image](https://user-images.githubusercontent.com/10829171/195997079-618f4632-3ccf-48b9-bc43-a309b85d34dc.png)
   
   ### Reason analyze (If you can)
   
   ![image](https://user-images.githubusercontent.com/10829171/195997124-bd1a397e-ab84-403d-97fa-ec5b737c7ab0.png)
   
   The TableTokenGenerator class determines whether the logical table name and the actual table name are consistent, and skips the rewriting if they are consistent, while the binding table is rewritten depending on the primary table, which will cause other tables in the binding table to be unable to be rewritten and an execution error will occur.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ```sql
   CREATE SHARDING TABLE RULE t_order (
   DATANODES("ds_${0..4}.t_order"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME=inline,PROPERTIES("algorithm-expression"="ds_${order_id % 5}"))))
   );
   
   CREATE SHARDING TABLE RULE t_order_item (
   DATANODES("ds_${0..4}.t_order_item_test"),
   DATABASE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES("algorithm-expression"="ds_${order_id% 5}")))),
   );
   ```
   
   Then execute `select * from t_order o inner join t_order_item i on o.order_id = i.order_id where o.order_id = 1`
   
   ### 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


[GitHub] [shardingsphere] tuichenchuxin closed issue #21594: Wrong SQL rewrite result occurs when part of logical table name of the binding table is consistent with the actual table name, and some are inconsistent

Posted by GitBox <gi...@apache.org>.
tuichenchuxin closed issue #21594: Wrong SQL rewrite result occurs when part of logical table name of the binding table is consistent with the actual table name, and some are inconsistent
URL: https://github.com/apache/shardingsphere/issues/21594


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