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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Nov 16 10:12:21 PST 2013


Author: martinl
Date: 2013-11-16 10:12:21 -0800 (Sat, 16 Nov 2013)
New Revision: 58238

Modified:
   grass/trunk/lib/vector/Vlib/open_pg.c
Log:
vlib/pg: check also topology extension when required

Modified: grass/trunk/lib/vector/Vlib/open_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open_pg.c	2013-11-16 17:19:04 UTC (rev 58237)
+++ grass/trunk/lib/vector/Vlib/open_pg.c	2013-11-16 18:12:21 UTC (rev 58238)
@@ -511,7 +511,16 @@
         PQfinish(pg_info->conn);
         G_fatal_error(_("Spatial-enabled PostGIS database is required"));
     }
-    
+
+    if (pg_info->toposchema_name) {
+        /* check if topology schema exists */
+        sprintf(stmt, "SELECT COUNT(*) FROM pg_tables WHERE schemaname = 'topology'");
+        if (Vect__execute_get_value_pg(pg_info->conn, stmt) == 0) {
+            PQfinish(pg_info->conn);
+            G_fatal_error(_("PostGIS Topology extension not found in the database"));
+        }
+    }
+
     /* print notice messages only on verbose level */
     PQsetNoticeProcessor(pg_info->conn, notice_processor, NULL);
 



More information about the grass-commit mailing list