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 2019/07/18 10:44:37 UTC

[GitHub] [incubator-shardingsphere] Sy9876 opened a new issue #2725: why "select max(a) + 1 from sy" not supported even table sy is not a sharding table?

Sy9876 opened a new issue #2725: why "select max(a) + 1 from sy" not supported even table sy is not a sharding table?
URL: https://github.com/apache/incubator-shardingsphere/issues/2725
 
 
   ## Feature Request
   
   **For English only**, other languages will not accept.
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response **more than 7 days** and we cannot make decision by current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Is your feature request related to a problem?
   When I execute the SQL on Sharding-Proxy-3.0.0, following exception occurs.
   ```
   mysql> select max(a)+1 from sy;
   ERROR 3054 (HY000): Unknown exception: Can't find index: AggregationSelectItem(type=MAX, innerExpression=(a), alias=Optional.absent(), derivedAggregationSelectItems=[], index=-1), please add alias for aggregate selections
   ```
   
   Table **sy** is not a sharding table.  In my sharding rule, table sy is not configured.
   ```
   shardingRule:
     defaultDataSourceName: ds_0
     defaultDatabaseStrategy:
       none:
     defaultTableStrategy:
       none:
     tables:
   ```
   I think sharding-proxy should use defaultTableStrategy-none rule for the SQL, send the original SQL to mysql directly.
   
   ### Describe the feature you would like.
   If a SQL statement only use none sharding tables, then send it to mysql directly.
   
   ### PS.
   Following result is directly run on mysql.
   ```
   mysql> show create table sy \G
   *************************** 1. row **************
          Table: sy
   Create Table: CREATE TABLE `sy` (
     `a` int(11) DEFAULT NULL
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
   1 row in set (0.10 sec)
   
   mysql> select * from sy;
   +------+
   | a    |
   +------+
   |    1 |
   |    2 |
   +------+
   2 rows in set (0.07 sec)
   
   mysql> select max(a)+1 from sy;
   +----------+
   | max(a)+1 |
   +----------+
   |        3 |
   +----------+
   1 row in set (0.09 sec)
   ```
   

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


With regards,
Apache Git Services