[QGIS Commit] r8444 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu May 15 15:24:05 EDT 2008
Author: jef
Date: 2008-05-15 15:24:05 -0400 (Thu, 15 May 2008)
New Revision: 8444
Modified:
trunk/qgis/src/app/qgsdbsourceselect.cpp
Log:
implement #1087
Modified: trunk/qgis/src/app/qgsdbsourceselect.cpp
===================================================================
--- trunk/qgis/src/app/qgsdbsourceselect.cpp 2008-05-15 16:50:00 UTC (rev 8443)
+++ trunk/qgis/src/app/qgsdbsourceselect.cpp 2008-05-15 19:24:05 UTC (rev 8444)
@@ -591,17 +591,20 @@
sql = "select pg_class.relname,pg_namespace.nspname,pg_attribute.attname,pg_class.relkind "
"from pg_attribute, pg_class, pg_namespace "
"where pg_namespace.oid = pg_class.relnamespace "
- "and pg_attribute.atttypid = regtype('geometry') "
"and pg_attribute.attrelid = pg_class.oid "
+ "and ("
+ "pg_attribute.atttypid = regtype('geometry')"
+ " or "
+ "pg_attribute.atttypid IN (select oid FROM pg_type WHERE typbasetype=regtype('geometry'))"
+ ") "
"and has_schema_privilege(pg_namespace.nspname,'usage') "
"and has_table_privilege('\"'||pg_namespace.nspname||'\".\"'||pg_class.relname||'\"','select') ";
// user has select privilege
if (searchPublicOnly)
sql += "and pg_namespace.nspname = 'public' ";
- sql += "and pg_namespace.nspname||'.'||pg_class.relname not in " // needs to be table and schema
- "(select f_table_schema||'.'||f_table_name from geometry_columns) "
- "and pg_class.relkind in ('v', 'r')"; // only from views and relations (tables)
+ sql += "and not exists (select * from geometry_columns WHERE pg_namespace.nspname=f_table_schema AND pg_class.relname=f_table_name) "
+ "and pg_class.relkind in ('v', 'r')"; // only from views and relations (tables)
result = PQexec(pg, sql.toUtf8());
More information about the QGIS-commit
mailing list