Fixed keyerror issue in schema diff for 'attnum' and 'edit_types' parameter. Fixes #6755

This commit is contained in:
Akshay Joshi
2021-09-28 15:03:28 +05:30
parent 2265ffc0a7
commit 1569be7866
3 changed files with 3 additions and 7 deletions

View File

@@ -170,12 +170,7 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
tmp = copy.deepcopy(item)
if tmp and source != tmp:
tmp_updated = copy.deepcopy(source)
# Preserve the column number
tmp_updated['attnum'] = tmp['attnum']
if item['typname'] not in tmp_updated['edit_types']:
tmp_updated['col_type_conversion'] = False
updated.append(tmp_updated)
updated.append(source)
target_cols.remove(tmp)
elif tmp and source == tmp:
target_cols.remove(tmp)

View File

@@ -1276,7 +1276,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
"/".join([self.column_template_path,
self._PROPERTIES_SQL]),
tid=tid,
clid=c['attnum'],
clid=c['attnum'] if 'attnum' in c else None,
show_sys_objects=self.blueprint.show_system_objects
)