TeslaCN opened a new issue #11589:
URL: https://github.com/apache/shardingsphere/issues/11589


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   master
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   Proxy
   
   ### Expected behavior
   Rewrite logic table `bmsql_oorder` to actual table.
   
   ### Actual behavior
   The logic table `bmsql_oorder` in subquery was not rewrote.
   
   ```
   [INFO ] 2021-07-30 18:59:15.271 [Connection-2-ThreadExecutor] 
ShardingSphere-SQL - Logic SQL: SELECT o_id, o_entry_d, o_carrier_id     FROM 
bmsql_oorder     WHERE o_w_id = ? AND o_d_id = ? AND o_c_id = ?       AND o_id 
= (          SELECT max(o_id)               FROM bmsql_oorder               
WHERE o_w_id = ? AND o_d_id = ? AND o_c_id = ?          )
   [INFO ] 2021-07-30 18:59:15.271 [Connection-2-ThreadExecutor] 
ShardingSphere-SQL - SQLStatement: 
PostgreSQLSelectStatement(limit=Optional.empty, lock=Optional.empty, 
window=Optional.empty)
   [INFO ] 2021-07-30 18:59:15.271 [Connection-2-ThreadExecutor] 
ShardingSphere-SQL - Actual SQL: ds_0 ::: SELECT o_id, o_entry_d, o_carrier_id  
   FROM bmsql_oorder_0     WHERE o_w_id = ? AND o_d_id = ? AND o_c_id = ?       
AND o_id = (          SELECT max(o_id)               FROM bmsql_oorder          
     WHERE o_w_id = ? AND o_d_id = ? AND o_c_id = ?          ) ::: [24, 1, 400, 
24, 1, 400]
   ```
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   
   ```yaml
       tables:
         bmsql_oorder:
           actualDataNodes: ds_${0..3}.bmsql_oorder_${0..3}
           databaseStrategy:
             standard:
               shardingColumn: o_w_id
               shardingAlgorithmName: bmsql_oorder_database_inline
           tableStrategy:
             standard:
               shardingColumn: o_c_id
               shardingAlgorithmName: bmsql_oorder_table_inline
   
       shardingAlgorithms:
         bmsql_oorder_database_inline:
           type: INLINE
           props:
             algorithm-expression: ds_${o_w_id & 3}
   
         bmsql_oorder_table_inline:
           type: INLINE
           props:
             algorithm-expression: bmsql_oorder_${o_c_id & 3}
   ```
   
   


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