Fixed #30331 -- Added support for psycopg2 2.8.

This commit is contained in:
Mariusz Felisiak 2019-04-05 11:05:53 +02:00 committed by GitHub
parent 755673e1bc
commit 5efaf078f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -77,7 +77,18 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
""", [table_name]) """, [table_name])
field_map = {line[0]: line[1:] for line in cursor.fetchall()} 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)) 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=()): def get_sequences(self, cursor, table_name, table_fields=()):
cursor.execute(""" cursor.execute("""

View File

@ -12,3 +12,5 @@ Bugfixes
* Fixed a regression in Django 2.1 that caused the incorrect quoting of * Fixed a regression in Django 2.1 that caused the incorrect quoting of
database user password when using :djadmin:`dbshell` on Oracle database user password when using :djadmin:`dbshell` on Oracle
(:ticket:`30307`). (:ticket:`30307`).
* Added compatibility for ``psycopg2`` 2.8 (:ticket:`30331`).