Feature request #11614

Order PostGIS key selection column by order in table/view

Added by James Haggerty about 10 years ago. Updated about 7 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Unknown
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:19868

Description

I have a view which, depending on what the Postgres query analyser does, presents the key attributes in an annoying order (booleans first, if pg_attribute is the initial table). I would really like users of the database to have a sane key selected first, in this case the first column in the view. This could be very easily achieved by adding

ORDER BY attnum
to this query:

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')

https://github.com/qgis/QGIS/blob/a3447dd9a346f6d5e08451b7c5666a37046435bc/src/providers/postgres/qgspostgresconn.cpp#L300

Thanks!

History

#1 Updated by Giovanni Manghi over 7 years ago

  • Easy fix? set to No

#2 Updated by Jürgen Fischer about 7 years ago

  • Category set to Unknown

Also available in: Atom PDF