summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql_psycopg2
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2012-09-17 23:45:00 +0100
committerAndrew Godwin <andrew@aeracode.org>2012-09-17 23:45:00 +0100
commitc5e2ecae6949d4e89530610d768bbbd563ddc19b (patch)
tree322a3e2a7f1abd32313f84d1c42ed470497b9405 /django/db/backends/postgresql_psycopg2
parentd0b353696478a05937377dd5c8289e69a95f059a (diff)
Fix bug in get_indexes affecting the tests
Diffstat (limited to 'django/db/backends/postgresql_psycopg2')
-rw-r--r--django/db/backends/postgresql_psycopg2/introspection.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/django/db/backends/postgresql_psycopg2/introspection.py b/django/db/backends/postgresql_psycopg2/introspection.py
index 5a29932859..d43b95406c 100644
--- a/django/db/backends/postgresql_psycopg2/introspection.py
+++ b/django/db/backends/postgresql_psycopg2/introspection.py
@@ -86,7 +86,13 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
# Here, we skip any indexes across multiple fields.
if ' ' in row[1]:
continue
- indexes[row[0]] = {'primary_key': row[3], 'unique': row[2]}
+ if row[0] not in indexes:
+ indexes[row[0]] = {'primary_key': False, 'unique': False}
+ # It's possible to have the unique and PK constraints in separate indexes.
+ if row[3]:
+ indexes[row[0]]['primary_key'] = True
+ if row[2]:
+ indexes[row[0]]['unique'] = True
return indexes
def get_constraints(self, cursor, table_name):