mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed an issue where schema diff is showing identical table as different due to default vacuum settings. Fixes #5826
This commit is contained in:
@@ -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 #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 #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 #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 #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 #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.
|
| `Issue #5841 <https://redmine.postgresql.org/issues/5841>`_ - Fixed an issue where the server is not able to connect using the service.
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
|
|||||||
table_keys_to_ignore = ['oid', 'schema', 'edit_types', 'attnum',
|
table_keys_to_ignore = ['oid', 'schema', 'edit_types', 'attnum',
|
||||||
'col_type', 'references', 'reltuples', 'oid-2',
|
'col_type', 'references', 'reltuples', 'oid-2',
|
||||||
'rows_cnt', 'seqrelid', 'atttypid', 'elemoid',
|
'rows_cnt', 'seqrelid', 'atttypid', 'elemoid',
|
||||||
'hastoasttable', 'relhassubclass', 'relacl_str']
|
'hastoasttable', 'relhassubclass', 'relacl_str',
|
||||||
|
'setting']
|
||||||
|
|
||||||
constraint_keys_to_ignore = ['relname', 'nspname', 'parent_tbl',
|
constraint_keys_to_ignore = ['relname', 'nspname', 'parent_tbl',
|
||||||
'attrelid', 'adrelid', 'fknsp', 'confrelid',
|
'attrelid', 'adrelid', 'fknsp', 'confrelid',
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
|||||||
{'get': 'get_toast_table_vacuum'}]
|
{'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):
|
def __init__(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -705,6 +705,7 @@ def compare_database_objects(**kwargs):
|
|||||||
if hasattr(view, 'compare'):
|
if hasattr(view, 'compare'):
|
||||||
msg = gettext('Comparing {0}'). \
|
msg = gettext('Comparing {0}'). \
|
||||||
format(gettext(view.blueprint.collection_label))
|
format(gettext(view.blueprint.collection_label))
|
||||||
|
app.logger.debug(msg)
|
||||||
diff_model_obj.set_comparison_info(msg, total_percent)
|
diff_model_obj.set_comparison_info(msg, total_percent)
|
||||||
# Update the message and total percentage in session object
|
# Update the message and total percentage in session object
|
||||||
update_session_diff_transaction(trans_id, session_obj,
|
update_session_diff_transaction(trans_id, session_obj,
|
||||||
@@ -759,6 +760,7 @@ def compare_schema_objects(**kwargs):
|
|||||||
msg = gettext('Comparing {0} of schema \'{1}\''). \
|
msg = gettext('Comparing {0} of schema \'{1}\''). \
|
||||||
format(gettext(view.blueprint.collection_label),
|
format(gettext(view.blueprint.collection_label),
|
||||||
gettext(schema_name))
|
gettext(schema_name))
|
||||||
|
app.logger.debug(msg)
|
||||||
diff_model_obj.set_comparison_info(msg, total_percent)
|
diff_model_obj.set_comparison_info(msg, total_percent)
|
||||||
# Update the message and total percentage in session object
|
# Update the message and total percentage in session object
|
||||||
update_session_diff_transaction(trans_id, session_obj,
|
update_session_diff_transaction(trans_id, session_obj,
|
||||||
|
|||||||
@@ -10,10 +10,8 @@
|
|||||||
"""Schema diff object comparison."""
|
"""Schema diff object comparison."""
|
||||||
|
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from flask_babelex import gettext
|
|
||||||
from pgadmin.utils.driver import get_driver
|
from pgadmin.utils.driver import get_driver
|
||||||
from config import PG_DEFAULT_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
|
from pgadmin.tools.schema_diff.directory_compare import compare_dictionaries
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
import copy
|
import copy
|
||||||
import string
|
import string
|
||||||
from pgadmin.tools.schema_diff.model import SchemaDiffModel
|
from pgadmin.tools.schema_diff.model import SchemaDiffModel
|
||||||
|
from flask import current_app
|
||||||
|
|
||||||
count = 1
|
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)
|
get_source_target_oid(source_dict, target_dict, key)
|
||||||
|
|
||||||
# Recursively Compare the two dictionary
|
# 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],
|
if are_dictionaries_identical(dict1[key], dict2[key],
|
||||||
ignore_whitespaces, ignore_keys):
|
ignore_whitespaces, ignore_keys):
|
||||||
identical.append({
|
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
|
# If number of keys are different in source and target then
|
||||||
# return False
|
# return False
|
||||||
if len(src_only) != len(tar_only):
|
if len(src_only) != len(tar_only):
|
||||||
|
current_app.logger.debug("Schema Diff: Number of keys are different "
|
||||||
|
"in source and target")
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
# If number of keys are same but key is not present in target then
|
# If number of keys are same but key is not present in target then
|
||||||
# return False
|
# return False
|
||||||
for key in src_only:
|
for key in src_only:
|
||||||
if key not in tar_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
|
return False
|
||||||
|
|
||||||
for key in source_dict.keys():
|
for key in source_dict.keys():
|
||||||
@@ -492,6 +503,10 @@ def are_dictionaries_identical(source_dict, target_dict, ignore_whitespaces,
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if source_value != target_value:
|
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 False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user