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/05/07 00:34:12 UTC

[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #17384: support pg create table sql for multi version -2

strongduanmu commented on code in PR #17384:
URL: https://github.com/apache/shardingsphere/pull/17384#discussion_r867276596


##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ddlgenerator/PostgresConstraintsLoader.java:
##########
@@ -155,8 +161,10 @@ private void getExclusionConstraintsColumns(final Map<String, Object> exclusionC
         Map<String, Object> map = new HashMap<>();
         map.put("cid", exclusionConstraintsProps.get("oid"));
         Collection<String> include = new LinkedList<>();
-        for (Map<String, Object> each : executeByTemplate(map, "exclusion_constraint/%s/get_constraint_include.ftl")) {
-            include.add(each.get("colname").toString());
+        if (getMajorVersion() >= 11) {

Review Comment:
   Can we extract 11 to constant?



##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ddlgenerator/PostgresConstraintsLoader.java:
##########
@@ -85,14 +85,20 @@ private void fetchConstraintsColumns(final Collection<Map<String, Object>> const
                 columns.add(column);
             }
             each.put("columns", columns);
-            Map<String, Object> parameters = new LinkedHashMap<>();
-            parameters.put("cid", each.get("oid"));
-            Collection<Object> includes = new LinkedList<>();
-            for (Map<String, Object> include : executeByTemplate(parameters, "index_constraint/%s/get_constraint_include.ftl")) {
-                includes.add(include.get("colname"));
+            getConstraintInclude(each);
+        }
+    }
+    
+    private void getConstraintInclude(final Map<String, Object> constraintsProp) {

Review Comment:
   @tuichenchuxin Can we rename this method to appendConstraints? 



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