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 2021/05/31 09:57:39 UTC

[GitHub] [shardingsphere] strongduanmu commented on issue #10563: count+order by not support

strongduanmu commented on issue #10563:
URL: https://github.com/apache/shardingsphere/issues/10563#issuecomment-851374562


   @dbzzzzz It can be seen from the error information that this error is thrown when PG executes SQL, and `SS` is responsible for routing, rewriting, executing and merging results.
   
   actual sql:
   
   ```
   [INFO ] 2021-05-31 17:49:45.008 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Logic SQL: select count(1) from t_order order by order_id desc;
   [INFO ] 2021-05-31 17:49:45.011 [Connection-2-ThreadExecutor] ShardingSphere-SQL - SQLStatement: PostgreSQLSelectStatement(limit=Optional.empty, lock=Optional.empty)
   [INFO ] 2021-05-31 17:49:45.011 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_0 ::: select count(1) , order_id AS ORDER_BY_DERIVED_0 from t_order_0 order by order_id desc;
   [INFO ] 2021-05-31 17:49:45.011 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_0 ::: select count(1) , order_id AS ORDER_BY_DERIVED_0 from t_order_1 order by order_id desc;
   [INFO ] 2021-05-31 17:49:45.011 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_1 ::: select count(1) , order_id AS ORDER_BY_DERIVED_0 from t_order_0 order by order_id desc;
   [INFO ] 2021-05-31 17:49:45.011 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_1 ::: select count(1) , order_id AS ORDER_BY_DERIVED_0 from t_order_1 order by order_id desc;
   ```
   error message:
   ```
   org.postgresql.util.PSQLException: ERROR: column "t_order_0.order_id" must appear in the GROUP BY clause or be used in an aggregate function
     位置:19
   ```
   


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