zjcnb commented on a change in pull request #11457:
URL: https://github.com/apache/shardingsphere/pull/11457#discussion_r675283160



##########
File path: 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rewrite/parameter/impl/ShardingGeneratedKeyInsertValueParameterRewriter.java
##########
@@ -34,13 +34,15 @@
  */
 @Setter
 public final class ShardingGeneratedKeyInsertValueParameterRewriter implements 
ParameterRewriter<InsertStatementContext> {
-    
+
     @Override
     public boolean isNeedRewrite(final SQLStatementContext 
sqlStatementContext) {
-        return sqlStatementContext instanceof InsertStatementContext 
-                && ((InsertStatementContext) 
sqlStatementContext).getGeneratedKeyContext().isPresent() && 
((InsertStatementContext) 
sqlStatementContext).getGeneratedKeyContext().get().isGenerated();
+        return sqlStatementContext instanceof InsertStatementContext
+                && ((InsertStatementContext) 
sqlStatementContext).getGeneratedKeyContext().isPresent()
+                && ((InsertStatementContext) 
sqlStatementContext).getGeneratedKeyContext().get().isGenerated()
+                && !((InsertStatementContext) 
sqlStatementContext).getGeneratedKeyContext().get().getGeneratedValues().isEmpty();
     }
-    

Review comment:
       ok




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