Skip to content
Permalink
Browse files

Merge pull request #291 from strk/topogeom_and_geometry

Find topogeometry fields in tables with a geometry/geography field
  • Loading branch information
jef-n committed Oct 13, 2012
2 parents e576d93 + 30c08cb commit ac3f33d0680143114d70e0053c022e79d979f53d
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/providers/postgres/qgspostgresconn.cpp
@@ -306,6 +306,8 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP

mLayersSupported.clear();

// TODO: query topology.layer too !

for ( int i = 0; i < 2; i++ )
{
QString gtableName, columnName;
@@ -413,17 +415,17 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP
if ( searchPublicOnly )
sql += " AND pg_namespace.nspname='public'";

// skip columns of which we already derived information from the metadata tables
if ( nColumns > 0 )
{
// TODO: handle this for the topogeometry case
sql += " AND (pg_namespace.nspname,pg_class.relname) NOT IN (SELECT f_table_schema,f_table_name FROM geometry_columns)";
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)";

if ( nGTables > 1 )
{
// TODO: handle this for the topogeometry case
// TODO: handle this for the geometry case ?
sql += " AND (pg_namespace.nspname,pg_class.relname) NOT IN (SELECT f_table_schema,f_table_name FROM geography_columns)";
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)";
}

// TODO: handle this for the topogeometry case (once we lookup topology.layer)
}

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

0 comments on commit ac3f33d

Please sign in to comment.
You can’t perform that action at this time.