[GRASS-SVN] r58314 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Nov 26 14:08:19 PST 2013


Author: martinl
Date: 2013-11-26 14:08:19 -0800 (Tue, 26 Nov 2013)
New Revision: 58314

Modified:
   grass/trunk/lib/vector/Vlib/write_pg.c
Log:
vlib/pg: do not change constrains to deferrable in topo_geo_only mode


Modified: grass/trunk/lib/vector/Vlib/write_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_pg.c	2013-11-26 20:43:03 UTC (rev 58313)
+++ grass/trunk/lib/vector/Vlib/write_pg.c	2013-11-26 22:08:19 UTC (rev 58314)
@@ -862,17 +862,19 @@
     }
     
     /* 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 @@
             "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;



More information about the grass-commit mailing list