summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/introspection.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-11-10 16:38:43 +0100
committerGitHub <noreply@github.com>2021-11-10 16:38:43 +0100
commit0b95a96ee10d3e12aef01d449467bcf4641286b4 (patch)
tree58c246817a10ff66995d2e980d72a5a8cf4494c0 /django/db/backends/postgresql/introspection.py
parentafea68ca51c20b726d3b97aaffdfe4e3b632e435 (diff)
downloaddjango-0b95a96ee10d3e12aef01d449467bcf4641286b4.tar.gz
Removed DatabaseIntrospection.get_key_columns().
Thanks Simon Charette for the report.
Diffstat (limited to 'django/db/backends/postgresql/introspection.py')
-rw-r--r--django/db/backends/postgresql/introspection.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/django/db/backends/postgresql/introspection.py b/django/db/backends/postgresql/introspection.py
index 5a50ee68b7..f31d906a2f 100644
--- a/django/db/backends/postgresql/introspection.py
+++ b/django/db/backends/postgresql/introspection.py
@@ -121,9 +121,6 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
Return a dictionary of {field_name: (field_name_other_table, other_table)}
representing all foreign keys in the given table.
"""
- return {row[0]: (row[2], row[1]) for row in self.get_key_columns(cursor, table_name)}
-
- def get_key_columns(self, cursor, table_name):
cursor.execute("""
SELECT a1.attname, c2.relname, a2.attname
FROM pg_constraint con
@@ -137,7 +134,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
c1.relnamespace = c2.relnamespace AND
pg_catalog.pg_table_is_visible(c1.oid)
""", [table_name])
- return cursor.fetchall()
+ return {row[0]: (row[2], row[1]) for row in cursor.fetchall()}
def get_constraints(self, cursor, table_name):
"""