From 0b95a96ee10d3e12aef01d449467bcf4641286b4 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Wed, 10 Nov 2021 16:38:43 +0100 Subject: Removed DatabaseIntrospection.get_key_columns(). Thanks Simon Charette for the report. --- django/db/backends/postgresql/introspection.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'django/db/backends/postgresql/introspection.py') 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): """ -- cgit v1.2.1