[GRASS-SVN] r54007 - grass/trunk/lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Nov 24 03:12:28 PST 2012
Author: martinl
Date: 2012-11-24 03:12:27 -0800 (Sat, 24 Nov 2012)
New Revision: 54007
Modified:
grass/trunk/lib/vector/Vlib/read_pg.c
Log:
vlib/pg: fix sequential access (order by fid)
Modified: grass/trunk/lib/vector/Vlib/read_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/read_pg.c 2012-11-24 09:33:17 UTC (rev 54006)
+++ grass/trunk/lib/vector/Vlib/read_pg.c 2012-11-24 11:12:27 UTC (rev 54007)
@@ -1140,24 +1140,23 @@
if (!pg_info->toposchema_name) {
/* simple feature access */
sprintf(stmt,
- "DECLARE %s_%s%p CURSOR FOR SELECT %s,%s FROM \"%s\".\"%s\"",
+ "DECLARE %s_%s%p CURSOR FOR SELECT %s,%s FROM \"%s\".\"%s\" ORDER BY %s",
pg_info->schema_name, pg_info->table_name, pg_info->conn,
pg_info->geom_column, pg_info->fid_column, pg_info->schema_name,
- pg_info->table_name);
+ pg_info->table_name, pg_info->fid_column);
}
else {
/* topology access */
sprintf(stmt,
"DECLARE %s_%s%p CURSOR FOR "
- "SELECT geom,row_number() OVER "
- "(ORDER BY ST_GeometryType(geom) DESC) AS fid,"
- "left_face,right_face FROM ("
- "SELECT geom,0 AS left_face, 0 AS right_face FROM "
+ "SELECT geom,fid,left_face,right_face FROM ("
+ "SELECT node_id AS fid,geom,0 AS left_face,0 AS right_face FROM "
"\"%s\".node WHERE 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) "
- "UNION ALL SELECT geom,left_face,right_face FROM \"%s\".edge) AS foo",
+ "UNION ALL SELECT edge_id AS fid,geom,left_face,right_face FROM \"%s\".edge "
+ "ORDER BY fid) AS foo",
pg_info->schema_name, pg_info->table_name, pg_info->conn,
pg_info->toposchema_name, pg_info->toposchema_name,
pg_info->toposchema_name, pg_info->toposchema_name);
More information about the grass-commit
mailing list