userkdg commented on issue #13940:
URL: 
https://github.com/apache/shardingsphere/issues/13940#issuecomment-987609469


   > @userkdg This is the result of my test, and no exception was found.
   > 
   > ```
   > [INFO ] 2021-12-07 09:17:23.323 [Connection-1-ThreadExecutor] 
ShardingSphere-SQL - Logic SQL: select count(0) as cnt from (select order_id 
from t_encrypt) as tmp
   > [INFO ] 2021-12-07 09:17:23.324 [Connection-1-ThreadExecutor] 
ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(limit=Optional.empty, 
lock=Optional.empty, window=Optional.empty)
   > [INFO ] 2021-12-07 09:17:23.324 [Connection-1-ThreadExecutor] 
ShardingSphere-SQL - Actual SQL: ds_1 ::: select count(0) as cnt from (select 
order_cipher AS order_id from t_encrypt) as tmp
   > ```
   
   bad!! subquery table set alias , proxy rewrite sql error .  such as :
   
   actual
   ``` sql
   MySQL [ec_order_db]> preview select count(1) as cnt from (select a.address 
from ec_oms_order a) as tmp;
   
+------------------+-----------------------------------------------------------------------------------------------+
   | data_source_name | sql                                                     
                                      |
   
+------------------+-----------------------------------------------------------------------------------------------+
   | ec_order_ds      | select count(1) as cnt from (select a.a.address_cipher 
AS address from ec_oms_order a) as tmp |
   
+------------------+-----------------------------------------------------------------------------------------------+
   
   ```
   Expected 
   
   ``` sql 
    select count(1) as cnt from (select a.address_cipher AS address from 
ec_oms_order a) as tmp
   ```
   
   


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