From 5efaf078f7609a8c95045bcfdab0ba256b5449bf Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Fri, 5 Apr 2019 11:05:53 +0200 Subject: [PATCH] Fixed #30331 -- Added support for psycopg2 2.8. --- django/db/backends/postgresql/introspection.py | 13 ++++++++++++- docs/releases/2.2.1.txt | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/django/db/backends/postgresql/introspection.py b/django/db/backends/postgresql/introspection.py index 3ce88ccfbf..9bd75bd847 100644 --- a/django/db/backends/postgresql/introspection.py +++ b/django/db/backends/postgresql/introspection.py @@ -77,7 +77,18 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): """, [table_name]) field_map = {line[0]: line[1:] for line in cursor.fetchall()} cursor.execute("SELECT * FROM %s LIMIT 1" % self.connection.ops.quote_name(table_name)) - return [FieldInfo(*line[0:6], *field_map[line.name]) for line in cursor.description] + return [ + FieldInfo( + line.name, + line.type_code, + line.display_size, + line.internal_size, + line.precision, + line.scale, + *field_map[line.name], + ) + for line in cursor.description + ] def get_sequences(self, cursor, table_name, table_fields=()): cursor.execute(""" diff --git a/docs/releases/2.2.1.txt b/docs/releases/2.2.1.txt index fb26e39a25..ab2a609a53 100644 --- a/docs/releases/2.2.1.txt +++ b/docs/releases/2.2.1.txt @@ -12,3 +12,5 @@ Bugfixes * Fixed a regression in Django 2.1 that caused the incorrect quoting of database user password when using :djadmin:`dbshell` on Oracle (:ticket:`30307`). + +* Added compatibility for ``psycopg2`` 2.8 (:ticket:`30331`).