From 8ab78dc40de131310fac8d8042190055c5bca9aa Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Wed, 27 Mar 2024 16:11:40 +0530 Subject: [PATCH] Fixed an issue where serial, bigserial, and smallserial columns were always shown as different in the schema diff. --- docs/en_US/release_notes_8_5.rst | 1 + .../servers/databases/schemas/tables/__init__.py | 6 ++++-- .../databases/schemas/tables/schema_diff_table_utils.py | 8 +++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/en_US/release_notes_8_5.rst b/docs/en_US/release_notes_8_5.rst index 11cd51032..8d170d559 100644 --- a/docs/en_US/release_notes_8_5.rst +++ b/docs/en_US/release_notes_8_5.rst @@ -34,6 +34,7 @@ Bug fixes | `Issue #4413 `_ - Fixed an issue in Schema Diff where Columns with sequences get altered unnecessarily. | `Issue #7116 `_ - Bug fixes and improvements in pgAdmin CLI. | `Issue #7165 `_ - Fixed schema diff wrong query generation for table, foreign table and sequence. + | `Issue #7210 `_ - Fixed an issue where table properties were not updating from properties dialog. | `Issue #7229 `_ - Fix an issue in table dialog where changing column name was not syncing table constraints appropriately. | `Issue #7255 `_ - Fixed an issue where taking backup of a shared server was using server owner's user name. | `Issue #7262 `_ - Fix an issue in editor where replace option in query tool edit menu is not working on non-Mac OS. diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py index 302fe1a2a..f8be21895 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py @@ -1674,7 +1674,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare): return sql @BaseTableView.check_precondition - def fetch_tables(self, sid, did, scid, tid=None): + def fetch_tables(self, sid, did, scid, tid=None, with_serial_cols=False): """ This function will fetch the list of all the tables and will be used by schema diff. @@ -1683,10 +1683,12 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare): :param did: Database Id :param scid: Schema Id :param tid: Table Id + :param with_serial_cols: :return: Table dataset """ - status, res = BaseTableView.fetch_tables(self, sid, did, scid, tid) + status, res = BaseTableView.fetch_tables(self, sid, did, scid, tid, + with_serial_cols) if not status: current_app.logger.error(res) return False diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/schema_diff_table_utils.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/schema_diff_table_utils.py index d0eded3e8..1820c6c49 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/schema_diff_table_utils.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/schema_diff_table_utils.py @@ -25,7 +25,7 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare): 'relacl_str', 'setting'] column_keys_to_ignore = ['atttypid', 'edit_types', 'elemoid', 'seqrelid', - 'indkey', 'seqtypid', 'defval'] + 'indkey', 'seqtypid'] constraint_keys_to_ignore = ['relname', 'nspname', 'parent_tbl', 'attrelid', 'adrelid', 'fknsp', 'confrelid', @@ -70,10 +70,12 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare): return internal_server_error(errormsg=target_schema) if 'scid' in source_params and source_params['scid'] is not None: - source_tables = self.fetch_tables(**source_params) + source_tables = self.fetch_tables(**source_params, + with_serial_cols=True) if 'scid' in target_params and target_params['scid'] is not None: - target_tables = self.fetch_tables(**target_params) + target_tables = self.fetch_tables(**target_params, + with_serial_cols=True) # If both the dict have no items then return None. if not (source_tables or target_tables) or (