Skip to content

Commit

Permalink
Merge pull request #291 from strk/topogeom_and_geometry
Browse files Browse the repository at this point in the history
Find topogeometry fields in tables with a geometry/geography field
  • Loading branch information
jef-n committed Oct 13, 2012
2 parents e576d93 + 30c08cb commit ac3f33d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/providers/postgres/qgspostgresconn.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ac3f33d

Please sign in to comment.