Fixed no attribute '_asdict' error when connecting the database server. Fixes #6663

This commit is contained in:
Akshay Joshi 2021-08-20 12:51:33 +05:30
parent 0c20466f2c
commit accc941818
2 changed files with 11 additions and 13 deletions

View File

@ -20,5 +20,6 @@ Bug fixes
| `Issue #6564 <https://redmine.postgresql.org/issues/6564>`_ - Fixed an issue where columns with sequences get altered unnecessarily with a schema diff tool. | `Issue #6564 <https://redmine.postgresql.org/issues/6564>`_ - Fixed an issue where columns with sequences get altered unnecessarily with a schema diff tool.
| `Issue #6572 <https://redmine.postgresql.org/issues/6572>`_ - Partially fixes the data output panel display issue. | `Issue #6572 <https://redmine.postgresql.org/issues/6572>`_ - Partially fixes the data output panel display issue.
| `Issue #6663 <https://redmine.postgresql.org/issues/6663>`_ - Fixed no attribute '_asdict' error when connecting the database server.
| `Issue #6671 <https://redmine.postgresql.org/issues/6671>`_ - Fixed UnboundLocalError where local variable 'user_id' referenced before assignment. | `Issue #6671 <https://redmine.postgresql.org/issues/6671>`_ - Fixed UnboundLocalError where local variable 'user_id' referenced before assignment.
| `Issue #6682 <https://redmine.postgresql.org/issues/6682>`_ - Renamed 'Auto rollback?' to 'Auto rollback on error?'. | `Issue #6682 <https://redmine.postgresql.org/issues/6682>`_ - Renamed 'Auto rollback?' to 'Auto rollback on error?'.

View File

@ -94,19 +94,16 @@ class _WrapperColumn(object):
# exposed as items of the cursor.description sequence. # exposed as items of the cursor.description sequence.
# Before psycopg2 2.8 the description attribute was a sequence # Before psycopg2 2.8 the description attribute was a sequence
# of simple tuples or namedtuples. # of simple tuples or namedtuples.
if psycopg2.__version__.find('2.8') != -1: ores = OrderedDict()
ores = OrderedDict() ores['name'] = self.orig_col.name
ores['name'] = self.orig_col.name ores['type_code'] = self.orig_col.type_code
ores['type_code'] = self.orig_col.type_code ores['display_size'] = self.orig_col.display_size
ores['display_size'] = self.orig_col.display_size ores['internal_size'] = self.orig_col.internal_size
ores['internal_size'] = self.orig_col.internal_size ores['precision'] = self.orig_col.precision
ores['precision'] = self.orig_col.precision ores['scale'] = self.orig_col.scale
ores['scale'] = self.orig_col.scale ores['null_ok'] = self.orig_col.null_ok
ores['null_ok'] = self.orig_col.null_ok ores['table_oid'] = self.orig_col.table_oid
ores['table_oid'] = self.orig_col.table_oid ores['table_column'] = self.orig_col.table_column
ores['table_column'] = self.orig_col.table_column
else:
ores = OrderedDict(self.orig_col._asdict())
name = ores['name'] name = ores['name']
if self.dummy_name: if self.dummy_name: