[GRASS-SVN] r58328 - grass/trunk/lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Nov 29 04:16:58 PST 2013
Author: martinl
Date: 2013-11-29 04:16:58 -0800 (Fri, 29 Nov 2013)
New Revision: 58328
Modified:
grass/trunk/lib/vector/Vlib/open_pg.c
Log:
vlib/pg: fix remaining issues in SQL statements related to the schema name
Modified: grass/trunk/lib/vector/Vlib/open_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open_pg.c 2013-11-29 11:34:42 UTC (rev 58327)
+++ grass/trunk/lib/vector/Vlib/open_pg.c 2013-11-29 12:16:58 UTC (rev 58328)
@@ -1495,22 +1495,22 @@
if (pg_info->topo_geo_only)
sprintf(stmt,
"SELECT tt.node_id,tt.geom,ft.%s FROM \"%s\".node AS tt "
- "LEFT JOIN \"%s\" AS ft ON "
+ "LEFT JOIN \"%s\".\"%s\" AS ft ON "
"(%s).type = 1 AND (%s).id = node_id WHERE containing_face "
"IS NULL AND node_id NOT IN "
"(SELECT node FROM (SELECT start_node AS node FROM \"%s\".edge "
"GROUP BY start_node UNION ALL SELECT end_node AS node FROM "
"\"%s\".edge GROUP BY end_node) AS foo) ORDER BY node_id",
- "fid", pg_info->toposchema_name, pg_info->table_name,
+ "fid", pg_info->toposchema_name, pg_info->schema_name, pg_info->table_name,
pg_info->topogeom_column, pg_info->topogeom_column, pg_info->toposchema_name,
pg_info->toposchema_name);
else
sprintf(stmt,
"SELECT tt.node_id,tt.geom,ft.%s "
- "FROM \"%s\".node AS tt LEFT JOIN \"%s\" AS ft ON "
+ "FROM \"%s\".node AS tt LEFT JOIN \"%s\".\"%s\" AS ft ON "
"(%s).type = 1 AND (%s).id = node_id WHERE node_id NOT IN "
"(SELECT node_id FROM \"%s\".%s) AND containing_face IS NULL ORDER BY node_id",
- "fid", pg_info->toposchema_name, pg_info->table_name,
+ "fid", pg_info->toposchema_name, pg_info->schema_name, pg_info->table_name,
pg_info->topogeom_column, pg_info->topogeom_column,
pg_info->toposchema_name, TOPO_TABLE_NODE);
G_debug(2, "SQL: %s", stmt);
@@ -1544,18 +1544,19 @@
if (pg_info->topo_geo_only)
sprintf(stmt, /* TODO: fix fid column! */
"SELECT edge_id,start_node,end_node,left_face,right_face AS right_area,tt.geom,ft.%s "
- "FROM \"%s\".edge AS tt LEFT JOIN \"%s\" AS ft ON (%s).type = 2 AND "
+ "FROM \"%s\".edge AS tt LEFT JOIN \"%s\".\"%s\" AS ft ON (%s).type = 2 AND "
"(%s).id = edge_id ORDER BY edge_id",
- "fid", pg_info->toposchema_name, pg_info->table_name,
+ "fid", pg_info->toposchema_name, pg_info->schema_name, pg_info->table_name,
pg_info->topogeom_column, pg_info->topogeom_column);
else
sprintf(stmt, /* TODO: fix fid column! */
"SELECT edge_id,start_node,end_node,left_area,right_area,tt.geom,ft.%s "
- "FROM \"%s\".edge AS tt LEFT JOIN \"%s\".%s ON "
- "edge_id = line_id LEFT JOIN \"%s\" AS ft ON (%s).type = 2 AND "
+ "FROM \"%s\".edge AS tt LEFT JOIN \"%s\".\"%s\" ON "
+ "edge_id = line_id LEFT JOIN \"%s\".\"%s\" AS ft ON (%s).type = 2 AND "
"(%s).id = edge_id ORDER BY edge_id",
"fid", pg_info->toposchema_name, pg_info->toposchema_name, TOPO_TABLE_LINE,
- pg_info->table_name, pg_info->topogeom_column, pg_info->topogeom_column);
+ pg_info->schema_name, pg_info->table_name, pg_info->topogeom_column,
+ pg_info->topogeom_column);
G_debug(2, "SQL: %s", stmt);
res = PQexec(pg_info->conn, stmt);
@@ -1591,24 +1592,24 @@
if (pg_info->topo_geo_only)
sprintf(stmt,
"SELECT node_id,tt.geom,containing_face,ft.%s FROM "
- "\"%s\".node AS tt LEFT JOIN \"%s\" AS ft ON "
+ "\"%s\".node AS tt LEFT JOIN \"%s\".\"%s\" AS ft ON "
"(%s).type = 3 AND (%s).id = containing_face WHERE containing_face "
"IS NOT NULL AND node_id NOT IN "
"(SELECT node FROM (SELECT start_node AS node FROM \"%s\".edge "
"GROUP BY start_node UNION ALL SELECT end_node AS node FROM "
"\"%s\".edge GROUP BY end_node) AS foo) ORDER BY node_id",
- "fid", pg_info->toposchema_name, pg_info->table_name,
+ "fid", pg_info->toposchema_name, pg_info->schema_name, pg_info->table_name,
pg_info->topogeom_column, pg_info->topogeom_column,
pg_info->toposchema_name,
pg_info->toposchema_name);
else
sprintf(stmt,
"SELECT tt.node_id,tt.geom,containing_face,ft.%s FROM "
- "\"%s\".node AS tt LEFT JOIN \"%s\" AS ft ON "
+ "\"%s\".node AS tt LEFT JOIN \"%s\".\"%s\" AS ft ON "
"(%s).type = 3 AND (%s).id = containing_face WHERE "
"node_id NOT IN (SELECT node_id FROM \"%s\".%s) AND containing_face "
"IS NOT NULL ORDER BY node_id",
- "fid", pg_info->toposchema_name, pg_info->table_name,
+ "fid", pg_info->toposchema_name, pg_info->schema_name, pg_info->table_name,
pg_info->topogeom_column, pg_info->topogeom_column,
pg_info->toposchema_name, TOPO_TABLE_NODE);
G_debug(2, "SQL: %s", stmt);
More information about the grass-commit
mailing list