From 0c6fbea59ba592586140115bd654c7f6c0983f56 Mon Sep 17 00:00:00 2001 From: Claude Paroz <claude@2xlibre.net> Date: Wed, 31 Aug 2016 19:45:06 +0200 Subject: [PATCH] Reformatted PostgreSQL query for better readability --- django/db/backends/postgresql/introspection.py | 13 ++++++------- 1 file 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])