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 2020/11/19 06:34:43 UTC

[GitHub] [shardingsphere] ztgoto opened a new issue #8216: The shard table name is not overwritten in the subquery

ztgoto opened a new issue #8216:
URL: https://github.com/apache/shardingsphere/issues/8216


   ### Which version of ShardingSphere did you use?
   
   version 4.1.1
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   ### Expected behavior
   The shard table name in the subquery was successfully rewritten
   
   
   ### Actual behavior
   The shard table name is not overwritten in the subquery
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   `
   SELECT 
   r.*
   FROM
   ( SELECT id FROM t_order WHERE member_id = ? AND `create_date` >= ? ORDER BY create_date DESC LIMIT 0, 10 ) o
   INNER JOIN t_record r ON r.order_id = o.id
   `
   shard table logical name `t_order`  not rewritten
   
   ### 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.

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



[GitHub] [shardingsphere] ztgoto commented on issue #8216: The shard table name is not overwritten in the subquery

Posted by GitBox <gi...@apache.org>.
ztgoto commented on issue #8216:
URL: https://github.com/apache/shardingsphere/issues/8216#issuecomment-731931352


   @terrymanu 
   The strange thing is that subqueries supported by 3.x are not supported by 4.x. 3.x bugs are not being repaired, the cost of project upgrade is too high


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

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



[GitHub] [shardingsphere] kimmking commented on issue #8216: The shard table name is not overwritten in the subquery

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #8216:
URL: https://github.com/apache/shardingsphere/issues/8216#issuecomment-730170978


   what is your config and logic/actual sql?


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

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



[GitHub] [shardingsphere] terrymanu closed issue #8216: The shard table name is not overwritten in the subquery

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #8216:
URL: https://github.com/apache/shardingsphere/issues/8216


   


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

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



[GitHub] [shardingsphere] terrymanu commented on issue #8216: The shard table name is not overwritten in the subquery

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #8216:
URL: https://github.com/apache/shardingsphere/issues/8216#issuecomment-731918192


   Subquery is not fully supported, please see document to get more information:
   https://shardingsphere.apache.org/document/current/en/features/sharding/use-norms/sql/


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

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



[GitHub] [shardingsphere] ztgoto commented on issue #8216: The shard table name is not overwritten in the subquery

Posted by GitBox <gi...@apache.org>.
ztgoto commented on issue #8216:
URL: https://github.com/apache/shardingsphere/issues/8216#issuecomment-730175215


   ```
       sharding:
         tables:
           t_order:
             actual-data-nodes: db.t_order_${0..16}
             table-strategy:
               standard:
                 sharding-column: member_id
                 precise-algorithm-class-name: classname
   ```
   
   logic sql
   ```
   SELECT r.* FROM ( SELECT id FROM t_order WHERE member_id = ? ANDcreate_date>= ? ORDER BY create_date DESC LIMIT 0, 10 ) o INNER JOIN t_record r ON r.order_id = o.id
   ```
   actual sql  not rewritten
   
   
   If it is changed to this, it is ok
   ```
   SELECT id FROM t_order WHERE member_id = ? AND create_date>= ? ORDER BY create_date DESC LIMIT 0, 10
   ```
   
   t_order is rewritten as t_order_11
   
   


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

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