GuiwenChen opened a new issue, #35245:
URL: https://github.com/apache/shardingsphere/issues/35245

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   5.5.2
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Expected behavior
   Successfully created a table .
   
   ### Actual behavior
   ```
   [create table customer] Query OK, 0 rows affected (0.04 sec)
   [create table order_item] ERROR 1050 (42S01): Table 'customer' already exists
   ```
   Create a table failed.
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   1. add rules
   ```
   databaseName: account_system
   
   dataSources:
     ds:
       url: 
jdbc:mysql://127.0.0.1:3306/account_system?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8
       username: root
       password: root
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   
   rules:
   - !SINGLE
     tables:
       - "*.*"
   - !SHARDING
     tables:
       order_item:
         actualDataNodes: ds.order_item,ds.order_item_${0..2}
         tableStrategy:
           standard:
             shardingColumn: company_id
             shardingAlgorithmName: order_item_inline
   
     shardingAlgorithms:
       order_item_inline:
         type: INLINE
         props:
           algorithm-expression: order_item_${company_id.intdiv(50)}
   ```
   
   2.create table customer,order_item
   ```
   CREATE TABLE `customer` (
     `company_id` bigint(20) NOT NULL,
     `id` bigint(20) NOT NULL,
     `is_deleted` bit(1) NOT NULL,
     `synced_id` bigint(20) NOT NULL,
     PRIMARY KEY (`company_id`,`id`),
     KEY `idx_customer_synced_id` (`company_id`,`is_deleted`,`synced_id`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
   
   CREATE TABLE `order_item` (
     `company_id` bigint(20) NOT NULL,
     `id` bigint(20) NOT NULL,
     `order_id` bigint(20) DEFAULT NULL,
     `customer_company_id` bigint(20) DEFAULT NULL,
     `customer_id` bigint(20) DEFAULT NULL,
     PRIMARY KEY (`company_id`,`id`),
     KEY `idx_order_item_company_order_id` (`company_id`,`order_id`),
     KEY `FKg11wcg7bs8o3931hl5t2n44tr` (`customer_company_id`,`customer_id`),
     CONSTRAINT `FKg11wcg7bs8o3931hl5t2n44tr` FOREIGN KEY 
(`customer_company_id`, `customer_id`) REFERENCES `customer` (`company_id`, 
`id`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
   ```
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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: 
notifications-unsubscr...@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to