Fixed an issue where the schema diff incorrectly marked tables as different due to schema-qualified trigger functions in the trigger definitions. #7523

This commit is contained in:
Akshay Joshi 2024-06-20 16:55:38 +05:30
parent 9026f46220
commit 3e7a220225
4 changed files with 19 additions and 6 deletions

View File

@ -34,10 +34,12 @@ Bug fixes
| `Issue #7241 <https://github.com/pgadmin-org/pgadmin4/issues/7241>`_ - Fixed an issue where resizable data editors in query tool should not be allowed to resize beyond the app window bounds.
| `Issue #7295 <https://github.com/pgadmin-org/pgadmin4/issues/7295>`_ - Fixed new line indentation in query editor and add a user preference to disable it.
| `Issue #7306 <https://github.com/pgadmin-org/pgadmin4/issues/7306>`_ - Ensure that a user can connect to a server using SSL certificates and identity files from a shared storage.
| `Issue #7316 <https://github.com/pgadmin-org/pgadmin4/issues/7316>`_ - Fixed an issue where object explorer toolbar button not showing shortcut in the tooltip.
| `Issue #7414 <https://github.com/pgadmin-org/pgadmin4/issues/7414>`_ - Add support for comments on RLS policy object.
| `Issue #7476 <https://github.com/pgadmin-org/pgadmin4/issues/7476>`_ - Fixed an issue where changing a column name should reflect in all the constraints in table object dialog and ERD table dialog.
| `Issue #7481 <https://github.com/pgadmin-org/pgadmin4/issues/7481>`_ - Fixed an issue where dark theme shows white background when all tabs are closed.
| `Issue #7516 <https://github.com/pgadmin-org/pgadmin4/issues/7516>`_ - Ensure preferences can be loaded using preferences.json.
| `Issue #7523 <https://github.com/pgadmin-org/pgadmin4/issues/7523>`_ - Fixed an issue where the schema diff incorrectly marked tables as different due to schema-qualified trigger functions in the trigger definitions.
| `Issue #7528 <https://github.com/pgadmin-org/pgadmin4/issues/7528>`_ - Fixed an issue where backslash breaks syntax highlighting.
| `Issue #7536 <https://github.com/pgadmin-org/pgadmin4/issues/7536>`_ - Search Objects dialog should focus on search input on open.
| `Issue #7542 <https://github.com/pgadmin-org/pgadmin4/issues/7542>`_ - Fixed incorrect sorting of size in statistics tab.

View File

@ -1,4 +1,8 @@
{% if without_schema %}
SELECT pg_catalog.quote_ident(proname) AS tfunctions
{% else %}
SELECT pg_catalog.quote_ident(nspname) || '.' || pg_catalog.quote_ident(proname) AS tfunctions
{% endif %}
FROM pg_catalog.pg_proc p, pg_catalog.pg_namespace n, pg_catalog.pg_language l
WHERE p.pronamespace = n.oid
AND p.prolang = l.oid

View File

@ -527,7 +527,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
status=200
)
def _fetch_properties(self, tid, trid):
def _fetch_properties(self, tid, trid, without_schema=False):
"""
This function is used to fetch the properties of the specified object
:param tid:
@ -550,7 +550,8 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
# Making copy of output for future use
data = dict(res['rows'][0])
data = trigger_utils.get_trigger_function_and_columns(
self.conn, data, tid, self.blueprint.show_system_objects)
self.conn, data, tid, self.blueprint.show_system_objects,
without_schema)
data = trigger_definition(data)
@ -1041,8 +1042,12 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
current_app.logger.error(triggers)
return False
without_schema = (
SchemaDiffRegistry.get_schema_diff_compare_mode() ==
'Schema Objects')
for row in triggers['rows']:
status, data = self._fetch_properties(tid, row['oid'])
status, data = self._fetch_properties(tid, row['oid'],
without_schema)
if status:
res[row['name']] = data

View File

@ -89,14 +89,15 @@ def get_column_details(conn, tid, clist, template_path=None):
@get_template_path
def get_trigger_function_and_columns(conn, data, tid,
show_system_objects, template_path=None):
def get_trigger_function_and_columns(conn, data, tid, show_system_objects,
without_schema=False, template_path=None):
"""
This function will return trigger function with schema name.
:param conn: Connection Object
:param data: Data
:param tid: Table ID
:param show_system_objects: show system object
:param without_schema: without_schema
:param template_path: Optional Template Path
:return:
"""
@ -106,7 +107,8 @@ def get_trigger_function_and_columns(conn, data, tid,
SQL = render_template("/".join(
[template_path, 'get_triggerfunctions.sql']),
tgfoid=data['tgfoid'],
show_system_objects=show_system_objects
show_system_objects=show_system_objects,
without_schema=without_schema
)
status, result = conn.execute_dict(SQL)