From 59582a811913466784f90506619882a0555e022e Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Thu, 26 Sep 2013 14:52:13 +0100 Subject: [PATCH] Enforce ordering on PostgreSQL get_constraints cols (refs #21134) --- django/db/backends/postgresql_psycopg2/introspection.py | 1 + 1 file changed, 1 insertion(+) diff --git a/django/db/backends/postgresql_psycopg2/introspection.py b/django/db/backends/postgresql_psycopg2/introspection.py index 57d9a67abf..046af9af55 100644 --- a/django/db/backends/postgresql_psycopg2/introspection.py +++ b/django/db/backends/postgresql_psycopg2/introspection.py @@ -137,6 +137,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): WHERE kc.table_schema = %s AND kc.table_name = %s + ORDER BY kc.ordinal_position ASC """, ["public", table_name]) for constraint, column, kind, used_cols in cursor.fetchall(): # If we're the first column, make the record