xbkaishui opened a new issue #7323:
URL: https://github.com/apache/shardingsphere/issues/7323


   ## Bug Report
   
   `
   ### SQL: CREATE TABLE IF NOT EXISTS t_order (order_id BIGINT AUTO_INCREMENT, 
user_id INT NOT NULL, address_id BIGINT NOT NULL, status VARCHAR(50), PRIMARY 
KEY (order_id));
   ### Cause: 
org.apache.shardingsphere.sharding.route.engine.exception.TableExistsException: 
Table 't_order' already exists.
        at 
org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
        at 
org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434)
        ... 17 more
   Caused by: 
org.apache.shardingsphere.sharding.route.engine.exception.TableExistsException: 
Table 't_order' already exists.
        at 
org.apache.shardingsphere.sharding.route.engine.validator.impl.ShardingCreateTableStatementValidator.preValidate(ShardingCreateTableStatementValidator.java:40)
        at 
org.apache.shardingsphere.sharding.route.engine.ShardingRouteDecorator.lambda$decorate$0(ShardingRouteDecorator.java:66)
   
   `
   
   **For English only**, other languages will not accept.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   5.0.0-RC1-SNAPSHOT
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   run and finish successfully 
   ### Actual behavior
   throws an exception 
   
   ### Reason analyze (If you can)
   The logic is in ShardingCreateTableStatementValidator.preValidate.  I think 
for it should not check if the create table contains   IF NOT EXISTS statement 
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   Run any the example module , with pre created table 
   


----------------------------------------------------------------
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:
[email protected]


Reply via email to