Skip to content
Permalink
Browse files

Merge pull request #2554 from vmora/order_pk_candidates

order postgres PK candidates by attnum
  • Loading branch information
jef-n committed Dec 8, 2015
2 parents 9118050 + ab0736a commit 13cbd8f58754fc6b7453700d7f89c0be4d6f86e2
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/providers/postgres/qgspostgresconn.cpp
@@ -330,7 +330,7 @@ void QgsPostgresConn::addColumnInfo( QgsPostgresLayerProperty& layerProperty, co
// TODO: optimize this query when pk candidates aren't needed
// could use array_agg() and count()
// array output would look like this: "{One,tWo}"
QString sql = QString( "SELECT attname, CASE WHEN typname = ANY(ARRAY['geometry','geography','topogeometry']) THEN 1 ELSE null END AS isSpatial FROM pg_attribute JOIN pg_type ON atttypid=pg_type.oid WHERE attrelid=regclass('%1.%2') AND attnum>0" )
QString sql = QString( "SELECT attname, CASE WHEN typname = ANY(ARRAY['geometry','geography','topogeometry']) THEN 1 ELSE null END AS isSpatial FROM pg_attribute JOIN pg_type ON atttypid=pg_type.oid WHERE attrelid=regclass('%1.%2') AND attnum>0 ORDER BY attnum" )
.arg( quotedIdentifier( schemaName ),
quotedIdentifier( viewName ) );
//QgsDebugMsg( sql );

0 comments on commit 13cbd8f

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