Skip to content
Permalink
Browse files

order postgres PK candidates by attnum

  • Loading branch information
vmora committed Dec 8, 2015
1 parent 6bfde52 commit ab0736a1d870f39c511da5fd6074c314f2172f9e
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 ab0736a

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