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 07:06:18 UTC

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

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