Skip to content

Commit c7a6056

Browse files
committed
Fixed an issue where Schema Diff does not ignore Tablespace for indexes. #9117
1 parent 55c5e86 commit c7a6056

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

docs/en_US/release_notes_9_10.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ Housekeeping
3030
Bug fixes
3131
*********
3232

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

web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/sql/default/properties.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ SELECT
55
pg_catalog.concat(cn.nspname, '."', c.collname,'"')
66
ELSE '' END AS collname,
77
d.typtypmod, d.typnotnull, d.typdefault, d.typndims, d.typdelim, bn.nspname as basensp,
8-
description, (SELECT COUNT(1) FROM pg_catalog.pg_type t2 WHERE t2.typname=d.typname) > 1 AS domisdup,
9-
(SELECT COUNT(1) FROM pg_catalog.pg_type t3 WHERE t3.typname=b.typname) > 1 AS baseisdup,
8+
description,
109
(SELECT
1110
pg_catalog.array_agg(provider || '=' || label)
1211
FROM

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/schema_diff_table_utils.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ def get_sql_from_submodule_diff(self, **kwargs):
301301
target = kwargs.get('target')
302302
diff_dict = kwargs.get('diff_dict')
303303
ignore_whitespaces = kwargs.get('ignore_whitespaces')
304+
ignore_tablespace = kwargs.get('ignore_tablespace')
304305

305306
# Get the difference result for source and target columns
306307
col_diff = self.table_col_comp(source, target)
@@ -365,7 +366,8 @@ def get_sql_from_submodule_diff(self, **kwargs):
365366
"source": source,
366367
"target": target,
367368
"target_schema": target_schema,
368-
"ignore_whitespaces": ignore_whitespaces
369+
"ignore_whitespaces": ignore_whitespaces,
370+
"ignore_tablespace": ignore_tablespace
369371
}
370372
diff = self._compare_source_and_target(
371373
intersect_keys, module_view, source_params,
@@ -414,11 +416,17 @@ def _compare_source_and_target(self, intersect_keys, module_view,
414416
target = kwargs['target']
415417
target_schema = kwargs['target_schema']
416418
ignore_whitespaces = kwargs.get('ignore_whitespaces')
419+
ignore_tablespace = kwargs.get('ignore_tablespace')
420+
temp_ignore_key = self.keys_to_ignore
421+
# if ignore_tablespace is True then add all the possible tablespace
422+
# keys to the ignore keys.
423+
if ignore_tablespace:
424+
temp_ignore_key = temp_ignore_key + ['spcname', 'spcoid']
417425

418426
for key in intersect_keys:
419427
# Recursively Compare the two dictionary
420428
if not are_dictionaries_identical(
421-
dict1[key], dict2[key], self.keys_to_ignore,
429+
dict1[key], dict2[key], temp_ignore_key,
422430
ignore_whitespaces):
423431
diff_ddl = module_view.ddl_compare(
424432
source_params=source_params,

web/pgadmin/tools/schema_diff/directory_compare.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ def _get_identical_and_different_list(intersect_keys, source_dict, target_dict,
277277
target_schema = kwargs.get('target_schema')
278278
ignore_whitespaces = kwargs.get('ignore_whitespaces')
279279
ignore_grants = kwargs.get('ignore_grants', False)
280+
ignore_tablespace = kwargs.get('ignore_tablespace', False)
280281

281282
for key in intersect_keys:
282283
source_object_id, target_object_id = \
@@ -357,7 +358,8 @@ def _get_identical_and_different_list(intersect_keys, source_dict, target_dict,
357358
target_params=temp_tgt_params,
358359
source=dict1[key], target=dict2[key], diff_dict=diff_dict,
359360
target_schema=target_schema,
360-
ignore_whitespaces=ignore_whitespaces)
361+
ignore_whitespaces=ignore_whitespaces,
362+
ignore_tablespace=ignore_tablespace)
361363
else:
362364
temp_src_params = copy.deepcopy(source_params)
363365
temp_tgt_params = copy.deepcopy(target_params)
@@ -491,7 +493,8 @@ def compare_dictionaries(**kwargs):
491493
"group_name": group_name,
492494
"target_schema": target_schema,
493495
"ignore_whitespaces": ignore_whitespaces,
494-
"ignore_grants": ignore_grants
496+
"ignore_grants": ignore_grants,
497+
"ignore_tablespace": ignore_tablespace,
495498
}
496499

497500
identical, different = _get_identical_and_different_list(

0 commit comments

Comments
 (0)