Просмотр исходного кода

vlib/pg: do not change constrains to deferrable in topo_geo_only mode

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58314 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 лет назад
Родитель
Сommit
ad2b468988
1 измененных файлов с 14 добавлено и 12 удалено
  1. 14 12
      lib/vector/Vlib/write_pg.c

+ 14 - 12
lib/vector/Vlib/write_pg.c

@@ -862,17 +862,19 @@ int create_topo_schema(struct Format_info_pg *pg_info, int with_z)
     }
     
     /* change constraints to deferrable initially deferred */
-    if (-1 == set_constraint_to_deferrable(pg_info, "node", "face_exists",
-                                           "containing_face", "face", "face_id") ||
-        -1 == set_constraint_to_deferrable(pg_info, "edge_data", "end_node_exists",
-                                           "end_node", "node", "node_id") ||
-        -1 == set_constraint_to_deferrable(pg_info, "edge_data", "left_face_exists",
-                                           "left_face", "face", "face_id") ||
-        -1 == set_constraint_to_deferrable(pg_info, "edge_data", "right_face_exists",
-                                           "right_face", "face", "face_id") ||
-        -1 == set_constraint_to_deferrable(pg_info, "edge_data", "start_node_exists",
-                                           "start_node", "node", "node_id"))
-        return -1;
+    if (!pg_info->topo_geo_only) {
+        if (-1 == set_constraint_to_deferrable(pg_info, "node", "face_exists",
+                                               "containing_face", "face", "face_id") ||
+            -1 == set_constraint_to_deferrable(pg_info, "edge_data", "end_node_exists",
+                                               "end_node", "node", "node_id") ||
+            -1 == set_constraint_to_deferrable(pg_info, "edge_data", "left_face_exists",
+                                               "left_face", "face", "face_id") ||
+            -1 == set_constraint_to_deferrable(pg_info, "edge_data", "right_face_exists",
+                                               "right_face", "face", "face_id") ||
+            -1 == set_constraint_to_deferrable(pg_info, "edge_data", "start_node_exists",
+                                               "start_node", "node", "node_id"))
+            return -1;
+    }
 
     /* create additional tables in topological schema to store
        GRASS topology in DB */
@@ -2748,7 +2750,7 @@ int set_constraint_to_deferrable(struct Format_info_pg *pg_info,
             "FOREIGN KEY (%s) REFERENCES \"%s\".%s (%s) "
             "DEFERRABLE INITIALLY DEFERRED",
             pg_info->toposchema_name, table, constraint, column,
-            pg_info->toposchema_name, ref_table);
+            pg_info->toposchema_name, ref_table, ref_column);
     if (-1 == Vect__execute_pg(pg_info->conn, stmt)) {
         Vect__execute_pg(pg_info->conn, "ROLLBACK");
         return -1;