Fixed an issue where Schema Diff does not ignore Tablespace for indexes. #9117

pull/9299/head
Akshay Joshi 2025-10-28 16:31:39 +05:30
parent 55c5e86fe0
commit c7a6056ee3
4 changed files with 18 additions and 7 deletions

View File

@ -31,3 +31,4 @@ Bug fixes
*********
| `Issue #8504 <https://github.com/pgadmin-org/pgadmin4/issues/8504>`_ - Fixed an issue where data output column resize is not sticking in Safari.
| `Issue #9117 <https://github.com/pgadmin-org/pgadmin4/issues/9117>`_ - Fixed an issue where Schema Diff does not ignore Tablespace for indexes.

View File

@ -5,8 +5,7 @@ SELECT
pg_catalog.concat(cn.nspname, '."', c.collname,'"')
ELSE '' END AS collname,
d.typtypmod, d.typnotnull, d.typdefault, d.typndims, d.typdelim, bn.nspname as basensp,
description, (SELECT COUNT(1) FROM pg_catalog.pg_type t2 WHERE t2.typname=d.typname) > 1 AS domisdup,
(SELECT COUNT(1) FROM pg_catalog.pg_type t3 WHERE t3.typname=b.typname) > 1 AS baseisdup,
description,
(SELECT
pg_catalog.array_agg(provider || '=' || label)
FROM

View File

@ -301,6 +301,7 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
target = kwargs.get('target')
diff_dict = kwargs.get('diff_dict')
ignore_whitespaces = kwargs.get('ignore_whitespaces')
ignore_tablespace = kwargs.get('ignore_tablespace')
# Get the difference result for source and target columns
col_diff = self.table_col_comp(source, target)
@ -365,7 +366,8 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
"source": source,
"target": target,
"target_schema": target_schema,
"ignore_whitespaces": ignore_whitespaces
"ignore_whitespaces": ignore_whitespaces,
"ignore_tablespace": ignore_tablespace
}
diff = self._compare_source_and_target(
intersect_keys, module_view, source_params,
@ -414,11 +416,17 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
target = kwargs['target']
target_schema = kwargs['target_schema']
ignore_whitespaces = kwargs.get('ignore_whitespaces')
ignore_tablespace = kwargs.get('ignore_tablespace')
temp_ignore_key = self.keys_to_ignore
# if ignore_tablespace is True then add all the possible tablespace
# keys to the ignore keys.
if ignore_tablespace:
temp_ignore_key = temp_ignore_key + ['spcname', 'spcoid']
for key in intersect_keys:
# Recursively Compare the two dictionary
if not are_dictionaries_identical(
dict1[key], dict2[key], self.keys_to_ignore,
dict1[key], dict2[key], temp_ignore_key,
ignore_whitespaces):
diff_ddl = module_view.ddl_compare(
source_params=source_params,

View File

@ -277,6 +277,7 @@ def _get_identical_and_different_list(intersect_keys, source_dict, target_dict,
target_schema = kwargs.get('target_schema')
ignore_whitespaces = kwargs.get('ignore_whitespaces')
ignore_grants = kwargs.get('ignore_grants', False)
ignore_tablespace = kwargs.get('ignore_tablespace', False)
for key in intersect_keys:
source_object_id, target_object_id = \
@ -357,7 +358,8 @@ def _get_identical_and_different_list(intersect_keys, source_dict, target_dict,
target_params=temp_tgt_params,
source=dict1[key], target=dict2[key], diff_dict=diff_dict,
target_schema=target_schema,
ignore_whitespaces=ignore_whitespaces)
ignore_whitespaces=ignore_whitespaces,
ignore_tablespace=ignore_tablespace)
else:
temp_src_params = copy.deepcopy(source_params)
temp_tgt_params = copy.deepcopy(target_params)
@ -491,7 +493,8 @@ def compare_dictionaries(**kwargs):
"group_name": group_name,
"target_schema": target_schema,
"ignore_whitespaces": ignore_whitespaces,
"ignore_grants": ignore_grants
"ignore_grants": ignore_grants,
"ignore_tablespace": ignore_tablespace,
}
identical, different = _get_identical_and_different_list(