Fixed an issue where columns with sequences get altered unnecessarily with a schema diff tool. Fixes #6564

This commit is contained in:
Akshay Joshi 2021-08-18 19:33:01 +05:30
parent d59063d79f
commit 7798584e1c
3 changed files with 29 additions and 12 deletions

View File

@ -18,4 +18,5 @@ Housekeeping
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 #6572 <https://redmine.postgresql.org/issues/6572>`_ - Partially fixes the data output panel display issue.

View File

@ -79,16 +79,21 @@ def login():
user.login_attempts += 1
left_attempts = \
config.MAX_LOGIN_ATTEMPTS - user.login_attempts
flash_login_attempt_error = \
gettext('You are left with {0} more attempts.'.
format(left_attempts))
if left_attempts > 1:
flash_login_attempt_error = \
gettext('{0} more attempts remaining.'.
format(left_attempts))
else:
flash_login_attempt_error = \
gettext('{0} more attempt remaining.'.
format(left_attempts))
db.session.commit()
for error in form.errors[field]:
if flash_login_attempt_error:
error = error + flash_login_attempt_error
flash_login_attempt_error = None
flash(error, 'warning')
if flash_login_attempt_error:
flash(flash_login_attempt_error, 'warning')
return redirect(get_post_logout_redirect())
# Authenticate the user

View File

@ -19,11 +19,13 @@ from pgadmin.tools.schema_diff.node_registry import SchemaDiffRegistry
class SchemaDiffTableCompare(SchemaDiffObjectCompare):
table_keys_to_ignore = ['oid', 'schema', 'edit_types', 'attnum',
table_keys_to_ignore = ['oid', 'schema', 'edit_types',
'col_type', 'references', 'reltuples', 'oid-2',
'rows_cnt', 'seqrelid', 'atttypid', 'elemoid',
'hastoasttable', 'relhassubclass', 'relacl_str',
'setting']
'rows_cnt', 'hastoasttable', 'relhassubclass',
'relacl_str', 'setting']
column_keys_to_ignore = ['attnum', 'atttypid', 'edit_types', 'elemoid',
'seqrelid']
constraint_keys_to_ignore = ['relname', 'nspname', 'parent_tbl',
'attrelid', 'adrelid', 'fknsp', 'confrelid',
@ -34,8 +36,9 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
'tgqual', 'tgconstraint']
index_keys_to_ignore = ['indrelid', 'indclass']
keys_to_ignore = table_keys_to_ignore + constraint_keys_to_ignore \
+ trigger_keys_to_ignore + index_keys_to_ignore
keys_to_ignore = table_keys_to_ignore + column_keys_to_ignore + \
constraint_keys_to_ignore + trigger_keys_to_ignore + \
index_keys_to_ignore
def compare(self, **kwargs):
"""
@ -156,8 +159,16 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
"""
tmp = None
for item in target_cols:
# ignore keys from the columns list
for ig_key in SchemaDiffTableCompare.column_keys_to_ignore:
if ig_key in source:
del source[ig_key]
if ig_key in item:
del item[ig_key]
if item['name'] == source['name']:
tmp = copy.deepcopy(item)
if tmp and source != tmp:
tmp_updated = copy.deepcopy(source)
# Preserve the column number