RaigorJiang opened a new issue #14554:
URL: https://github.com/apache/shardingsphere/issues/14554


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   5.0.1-SNAPSHOT master branch
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Expected behavior
   1. Use DistSQL `CREATE DEFAULT SHARDING DATABASE STRATEGY` to create a 
default sharding database strategy.
   ```sql
   CREATE DEFAULT SHARDING DATABASE STRATEGY (
     TYPE=standard,SHARDING_COLUMN=DEMO_ID,SHARDING_ALGORITHM=database_inline
   );
   ```
   2. The default sharding database strategy can work for routing.
   
   ### Actual behavior
   1. After create default sharding database strategy, the strategy in meta 
data is: 
   ```yaml
     defaultDatabaseStrategy:
       standard:
         shardingAlgorithmName: database_inline
         shardingColumn: demo_id
   ```
   We can see the shardingColumn became lower case.
   2. When execute query with sharding column, like:
   ```sql
   SELECT * FROM t_order WHERE DEMO_ID = 123456;
   ```
   An error occurs: 
   ```sql
   ERROR 1997 (C1997): Runtime exception: [Route table ds_null does not exist, 
available actual table: [xxx, xxx]]
   ```
   And, if change the sharding column in meta data to upper case, the strategy 
will work.
   
   ### Reason analyze (If you can)
   In `ShardingDistSQLStatementVisitor`, sharding column was changed to lower 
case: 
   ```java
   String shardingColumn = 
getIdentifierValue(shardingStrategyContext.shardingColumn().columnName()).toLowerCase();
   ```
   


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