[Sqlalchemy-tickets] [sqlalchemy] #2531: PostgreSQL multi-column primary keys reflected in wrong or
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2012-07-10 19:14:42
|
#2531: PostgreSQL multi-column primary keys reflected in wrong order
----------------------+----------------------------------------
Reporter: gthb | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: postgres | Severity: trivial - <10 minutes
Keywords: | Progress State: awaiting triage
----------------------+----------------------------------------
The reflection query for primary keys on PostgreSQL returns the correct
column names, but ordered as they appear in the table, which is not
necessarily the way they are ordered in the key.
Attaching a patch with a test that exhibits the problem, and a new query
that corrects it. The new query also drops the unnecessary join to
`pg_class`, but adds a subquery unnesting the key order (I didn't find an
obvious way to do this without the subquery). I doubt this is any slower,
but I haven't measured.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2531>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|