totalo commented on code in PR #22004:
URL: https://github.com/apache/shardingsphere/pull/22004#discussion_r1016494841


##########
kernel/single-table/core/src/main/java/org/apache/shardingsphere/singletable/route/engine/SingleTableStandardRouteEngine.java:
##########
@@ -82,9 +83,14 @@ private void route0(final RouteContext routeContext, final 
SingleTableRule rule)
         if (sqlStatement instanceof CreateTableStatement) {
             String dataSourceName = rule.assignNewDataSourceName();
             QualifiedTable table = singleTableNames.iterator().next();
-            if (isTableExists(table, rule)) {
+            boolean tableExists = isTableExists(table, rule);
+            boolean ifNotExists = 
CreateTableStatementHandler.ifNotExists((CreateTableStatement) sqlStatement);
+            if (tableExists && !ifNotExists) {
                 throw new TableExistsException(table.getTableName());
             }
+            if (tableExists) {
+                return;

Review Comment:
   Got it.



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