Skip to content

Commit 30c08cb

Browse files
author
Sandro Santilli
committedOct 13, 2012
Find topogeometry fields in tables with a geometry/geography field
Closes bug #6510
1 parent 600888f commit 30c08cb

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed
 

‎src/providers/postgres/qgspostgresconn.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP
306306

307307
mLayersSupported.clear();
308308

309+
// TODO: query topology.layer too !
310+
309311
for ( int i = 0; i < 2; i++ )
310312
{
311313
QString gtableName, columnName;
@@ -413,17 +415,17 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP
413415
if ( searchPublicOnly )
414416
sql += " AND pg_namespace.nspname='public'";
415417

418+
// skip columns of which we already derived information from the metadata tables
416419
if ( nColumns > 0 )
417420
{
418-
// TODO: handle this for the topogeometry case
419-
sql += " AND (pg_namespace.nspname,pg_class.relname) NOT IN (SELECT f_table_schema,f_table_name FROM geometry_columns)";
421+
sql += " AND (pg_namespace.nspname,pg_class.relname,pg_attribute.attname) NOT IN (SELECT f_table_schema,f_table_name,f_geometry_column FROM geometry_columns)";
420422

421423
if ( nGTables > 1 )
422424
{
423-
// TODO: handle this for the topogeometry case
424-
// TODO: handle this for the geometry case ?
425-
sql += " AND (pg_namespace.nspname,pg_class.relname) NOT IN (SELECT f_table_schema,f_table_name FROM geography_columns)";
425+
sql += " AND (pg_namespace.nspname,pg_class.relname,pg_attribute.attname) NOT IN (SELECT f_table_schema,f_table_name,f_geography_column FROM geography_columns)";
426426
}
427+
428+
// TODO: handle this for the topogeometry case (once we lookup topology.layer)
427429
}
428430

429431
sql += " AND pg_class.relkind IN ('v','r')"; // only from views and relations (tables)

0 commit comments

Comments
 (0)
Please sign in to comment.