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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 28 09:20:19 EDT 2012


Author: martinl
Date: 2012-03-28 06:20:19 -0700 (Wed, 28 Mar 2012)
New Revision: 51174

Modified:
   grass/trunk/lib/vector/Vlib/header.c
Log:
vlib: fix Vect_get_finfo_geometry_type() for PG links (schema required)



Modified: grass/trunk/lib/vector/Vlib/header.c
===================================================================
--- grass/trunk/lib/vector/Vlib/header.c	2012-03-28 13:18:29 UTC (rev 51173)
+++ grass/trunk/lib/vector/Vlib/header.c	2012-03-28 13:20:19 UTC (rev 51174)
@@ -412,15 +412,17 @@
 		
 	pg_info = &(Map->fInfo.pg);
 	sprintf(stmt, "SELECT type FROM geometry_columns "
-		"WHERE f_table_name = '%s'", pg_info->table_name);
+		"WHERE f_table_schema = '%s' AND f_table_name = '%s'",
+		pg_info->schema_name, pg_info->table_name);
 	G_debug(2, "SQL: %s", stmt);
 	
 	res = PQexec(pg_info->conn, stmt);
 	if (!res || PQresultStatus(res) != PGRES_TUPLES_OK ||
-	    PQntuples(res) != 1)
-	    G_warning("%s\n%s", _("Unable to get feature type."),
+	    PQntuples(res) != 1) {
+	    G_warning("%s\n%s", _("Unable to get feature type"),
 		      PQresultErrorMessage(res));
-	
+	    return NULL;
+	}
 	ftype_tmp = G_store(PQgetvalue(res, 0, 0));
 	PQclear(res);
 #endif



More information about the grass-commit mailing list