Fixed an issue where schema diff is showing identical table as different due to default vacuum settings. Fixes #5826

pull/35/head
Akshay Joshi 2020-09-24 13:24:25 +05:30
parent c1d04747a1
commit 68588fbb44
6 changed files with 21 additions and 4 deletions

View File

@ -22,6 +22,7 @@ Bug fixes
| `Issue #5739 <https://redmine.postgresql.org/issues/5739>`_ - Ensure that the import/export feature should work with SSH Tunnel.
| `Issue #5802 <https://redmine.postgresql.org/issues/5802>`_ - Remove maximum length on the password field in the server dialog.
| `Issue #5807 <https://redmine.postgresql.org/issues/5807>`_ - Fixed an issue where a column is renamed and then removed, then the drop SQL query takes the wrong column name.
| `Issue #5826 <https://redmine.postgresql.org/issues/5826>`_ - Fixed an issue where schema diff is showing identical table as different due to default vacuum settings.
| `Issue #5830 <https://redmine.postgresql.org/issues/5830>`_ - Fixed reverse engineering SQL where parenthesis is not properly arranged for View/MView definition.
| `Issue #5839 <https://redmine.postgresql.org/issues/5839>`_ - Ensure that multiple extensions can be dropped from the properties tab.
| `Issue #5841 <https://redmine.postgresql.org/issues/5841>`_ - Fixed an issue where the server is not able to connect using the service.

View File

@ -22,7 +22,8 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
table_keys_to_ignore = ['oid', 'schema', 'edit_types', 'attnum',
'col_type', 'references', 'reltuples', 'oid-2',
'rows_cnt', 'seqrelid', 'atttypid', 'elemoid',
'hastoasttable', 'relhassubclass', 'relacl_str']
'hastoasttable', 'relhassubclass', 'relacl_str',
'setting']
constraint_keys_to_ignore = ['relname', 'nspname', 'parent_tbl',
'attrelid', 'adrelid', 'fknsp', 'confrelid',

View File

@ -351,7 +351,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
{'get': 'get_toast_table_vacuum'}]
})
keys_to_ignore = ['oid', 'schema', 'xmin', 'oid-2']
keys_to_ignore = ['oid', 'schema', 'xmin', 'oid-2', 'setting']
def __init__(self, *args, **kwargs):
"""

View File

@ -705,6 +705,7 @@ def compare_database_objects(**kwargs):
if hasattr(view, 'compare'):
msg = gettext('Comparing {0}'). \
format(gettext(view.blueprint.collection_label))
app.logger.debug(msg)
diff_model_obj.set_comparison_info(msg, total_percent)
# Update the message and total percentage in session object
update_session_diff_transaction(trans_id, session_obj,
@ -759,6 +760,7 @@ def compare_schema_objects(**kwargs):
msg = gettext('Comparing {0} of schema \'{1}\''). \
format(gettext(view.blueprint.collection_label),
gettext(schema_name))
app.logger.debug(msg)
diff_model_obj.set_comparison_info(msg, total_percent)
# Update the message and total percentage in session object
update_session_diff_transaction(trans_id, session_obj,

View File

@ -10,10 +10,8 @@
"""Schema diff object comparison."""
from flask import render_template
from flask_babelex import gettext
from pgadmin.utils.driver import get_driver
from config import PG_DEFAULT_DRIVER
from pgadmin.utils.ajax import internal_server_error
from pgadmin.tools.schema_diff.directory_compare import compare_dictionaries

View File

@ -12,6 +12,7 @@
import copy
import string
from pgadmin.tools.schema_diff.model import SchemaDiffModel
from flask import current_app
count = 1
@ -227,6 +228,11 @@ def _get_identical_and_different_list(intersect_keys, source_dict, target_dict,
get_source_target_oid(source_dict, target_dict, key)
# Recursively Compare the two dictionary
current_app.logger.debug(
"Schema Diff: Source Dict: {0}".format(dict1[key]))
current_app.logger.debug(
"Schema Diff: Target Dict: {0}".format(dict2[key]))
if are_dictionaries_identical(dict1[key], dict2[key],
ignore_whitespaces, ignore_keys):
identical.append({
@ -439,12 +445,17 @@ def are_dictionaries_identical(source_dict, target_dict, ignore_whitespaces,
# If number of keys are different in source and target then
# return False
if len(src_only) != len(tar_only):
current_app.logger.debug("Schema Diff: Number of keys are different "
"in source and target")
return False
else:
# If number of keys are same but key is not present in target then
# return False
for key in src_only:
if key not in tar_only:
current_app.logger.debug(
"Schema Diff: Number of keys are same but key is not"
" present in target")
return False
for key in source_dict.keys():
@ -492,6 +503,10 @@ def are_dictionaries_identical(source_dict, target_dict, ignore_whitespaces,
continue
if source_value != target_value:
current_app.logger.debug(
"Schema Diff: Object name: '{0}', Source Value: '{1}', "
"Target Value: '{2}', Key: '{3}'".format(
source_dict['name'], source_value, target_value, key))
return False
return True