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 2022/11/08 06:36:36 UTC

[GitHub] [shardingsphere] totalo commented on a diff in pull request #22004: Do not throw an exception if the statement contains `if not exists`

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


##########
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) {

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

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