summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/introspection.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2016-08-31 19:45:06 +0200
committerClaude Paroz <claude@2xlibre.net>2016-09-12 09:26:33 +0200
commit0c6fbea59ba592586140115bd654c7f6c0983f56 (patch)
tree4755adab157e6c32a43bc8ff51aeb197276ea821 /django/db/backends/postgresql/introspection.py
parentd389125606152a6cd57d0f6cadeddf0bd6232215 (diff)
downloaddjango-0c6fbea59ba592586140115bd654c7f6c0983f56.tar.gz
Reformatted PostgreSQL query for better readability
Diffstat (limited to 'django/db/backends/postgresql/introspection.py')
-rw-r--r--django/db/backends/postgresql/introspection.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/django/db/backends/postgresql/introspection.py b/django/db/backends/postgresql/introspection.py
index 29e11499a9..a9a90253ec 100644
--- a/django/db/backends/postgresql/introspection.py
+++ b/django/db/backends/postgresql/introspection.py
@@ -210,13 +210,12 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
SELECT
*, unnest(i.indkey) as key, unnest(i.indoption) as option
FROM pg_index i
- ) idx, pg_class c, pg_class c2, pg_am am, pg_attribute attr
- WHERE c.oid=idx.indrelid
- AND idx.indexrelid=c2.oid
- AND attr.attrelid=c.oid
- AND attr.attnum=idx.key
- AND c2.relam=am.oid
- AND c.relname = %s
+ ) idx
+ LEFT JOIN pg_class c ON idx.indrelid = c.oid
+ LEFT JOIN pg_class c2 ON idx.indexrelid = c2.oid
+ LEFT JOIN pg_am am ON c2.relam = am.oid
+ LEFT JOIN pg_attribute attr ON attr.attrelid = c.oid AND attr.attnum = idx.key
+ WHERE c.relname = %s
) s2
GROUP BY indexname, indisunique, indisprimary, amname;
""", [table_name])