[GRASS-SVN] r51440 - grass/trunk/db/drivers/postgres

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Apr 14 11:27:52 EDT 2012


Author: martinl
Date: 2012-04-14 08:27:52 -0700 (Sat, 14 Apr 2012)
New Revision: 51440

Modified:
   grass/trunk/db/drivers/postgres/db.c
   grass/trunk/db/drivers/postgres/describe.c
   grass/trunk/db/drivers/postgres/globals.h
Log:
dbdriver(pg): ignore topogeometry columns


Modified: grass/trunk/db/drivers/postgres/db.c
===================================================================
--- grass/trunk/db/drivers/postgres/db.c	2012-04-14 08:56:35 UTC (rev 51439)
+++ grass/trunk/db/drivers/postgres/db.c	2012-04-14 15:27:52 UTC (rev 51440)
@@ -99,7 +99,7 @@
 		 "'float4', 'float8', 'numeric', "
 		 "'char', 'bpchar', 'varchar', 'text', "
 		 "'time', 'date', 'timestamp', "
-		 "'bool', 'geometry' ) order by oid");
+		 "'bool', 'geometry', 'topogeometry') order by oid");
     
     if (!res || PQresultStatus(res) != PGRES_TUPLES_OK) {
 	db_d_append_error(_("Unable to select data types"));
@@ -118,6 +118,7 @@
 
 	pg_types[row][0] = pgtype;
 
+        G_debug(3, "row = %d value = %s", row, PQgetvalue(res, row, 1));
 	if (strcmp(PQgetvalue(res, row, 1), "bit") == 0)
 	    type = PG_TYPE_BIT;
 	else if (strcmp(PQgetvalue(res, row, 1), "int2") == 0)
@@ -154,6 +155,8 @@
 	    type = PG_TYPE_BOOL;
 	else if (strcmp(PQgetvalue(res, row, 1), "geometry") == 0)
 	    type = PG_TYPE_POSTGIS_GEOM;
+	else if (strcmp(PQgetvalue(res, row, 1), "topogeometry") == 0)
+	    type = PG_TYPE_POSTGIS_TOPOGEOM;
 	else
 	    type = PG_TYPE_UNKNOWN;
 

Modified: grass/trunk/db/drivers/postgres/describe.c
===================================================================
--- grass/trunk/db/drivers/postgres/describe.c	2012-04-14 08:56:35 UTC (rev 51439)
+++ grass/trunk/db/drivers/postgres/describe.c	2012-04-14 15:27:52 UTC (rev 51440)
@@ -113,6 +113,11 @@
 			"will not be converted", fname);
 		continue;
 	    }
+	    else if (gpgtype == PG_TYPE_POSTGIS_TOPOGEOM) {
+		G_debug(1, "PostgreSQL driver: PostGIS column '%s', type 'topogeometry' "
+			"will not be converted", fname);
+		continue;
+	    }
 	    else {
 		/* Warn, ignore and continue */
 		G_warning(_("PostgreSQL driver: column '%s', type %d is not supported"),

Modified: grass/trunk/db/drivers/postgres/globals.h
===================================================================
--- grass/trunk/db/drivers/postgres/globals.h	2012-04-14 08:56:35 UTC (rev 51439)
+++ grass/trunk/db/drivers/postgres/globals.h	2012-04-14 15:27:52 UTC (rev 51440)
@@ -18,7 +18,7 @@
 } PGCONN;
 
 /* PostgreSQL data types defined in GRASS
-   (see also: /usr/include/pgsql/server/catalog/pg_type.h)
+   (see also: /usr/include/postgresql/<version>/server/catalog/pg_type.h)
    PostGIS types are encoded as 17xxx.
    Types/OIDs are fetched in db.c from server.
  */
@@ -48,7 +48,8 @@
 
     PG_TYPE_BOOL,		/* bool, boolean */
 
-    PG_TYPE_POSTGIS_GEOM	/* geometry column of PostGIS, GRASS internal type */
+    PG_TYPE_POSTGIS_GEOM,	/* geometry column of PostGIS, GRASS internal type */
+    PG_TYPE_POSTGIS_TOPOGEOM	/* topogeometry column of PostGIS, GRASS internal type */
 } PG_TYPES;
 
 



More information about the grass-commit mailing list