Browse Source

vlib: fix Vect_get_finfo_geometry_type() for PG links (schema required)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@51174 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 năm trước cách đây
mục cha
commit
ffd9b63cd4
1 tập tin đã thay đổi với 6 bổ sung4 xóa
  1. 6 4
      lib/vector/Vlib/header.c

+ 6 - 4
lib/vector/Vlib/header.c

@@ -412,15 +412,17 @@ const char *Vect_get_finfo_geometry_type(const struct Map_info *Map)
 		
 	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