Ensure that Schema Diff does not indicate a table as different when the trigger names are the same but the trigger function body is different. #5762
parent
dd45f06d50
commit
6c7bc1c815
|
@ -21,6 +21,7 @@ New features
|
||||||
************
|
************
|
||||||
|
|
||||||
| `Issue #7192 <https://github.com/pgadmin-org/pgadmin4/issues/7192>`_ - Changes in Query Tool, Debugger, and ERD Tool shortcuts to remove the use of Accesskey which will allow them to be customized.
|
| `Issue #7192 <https://github.com/pgadmin-org/pgadmin4/issues/7192>`_ - Changes in Query Tool, Debugger, and ERD Tool shortcuts to remove the use of Accesskey which will allow them to be customized.
|
||||||
|
| `Issue #7215 <https://github.com/pgadmin-org/pgadmin4/issues/7215>`_ - Added support for viewing PGD Clusters.
|
||||||
| `Issue #7411 <https://github.com/pgadmin-org/pgadmin4/issues/7411>`_ - Enhance the Delete dialog by highlighting the names of the objects to be deleted in bold.
|
| `Issue #7411 <https://github.com/pgadmin-org/pgadmin4/issues/7411>`_ - Enhance the Delete dialog by highlighting the names of the objects to be deleted in bold.
|
||||||
|
|
||||||
Housekeeping
|
Housekeeping
|
||||||
|
@ -32,6 +33,7 @@ Housekeeping
|
||||||
Bug fixes
|
Bug fixes
|
||||||
*********
|
*********
|
||||||
|
|
||||||
|
| `Issue #5762 <https://github.com/pgadmin-org/pgadmin4/issues/5762>`_ - Ensure that Schema Diff does not indicate a table as different when the trigger names are the same but the trigger function body is different.
|
||||||
| `Issue #5849 <https://github.com/pgadmin-org/pgadmin4/issues/5849>`_ - Disable ERD for system catalogs.
|
| `Issue #5849 <https://github.com/pgadmin-org/pgadmin4/issues/5849>`_ - Disable ERD for system catalogs.
|
||||||
| `Issue #6060 <https://github.com/pgadmin-org/pgadmin4/issues/6060>`_ - Disable Debugger for system catalogs.
|
| `Issue #6060 <https://github.com/pgadmin-org/pgadmin4/issues/6060>`_ - Disable Debugger for system catalogs.
|
||||||
| `Issue #6086 <https://github.com/pgadmin-org/pgadmin4/issues/6086>`_ - Fixed an issue where drag and drop publication and subscription name in SQL editors was not working.
|
| `Issue #6086 <https://github.com/pgadmin-org/pgadmin4/issues/6086>`_ - Fixed an issue where drag and drop publication and subscription name in SQL editors was not working.
|
||||||
|
|
|
@ -33,8 +33,8 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
|
||||||
'conkey', 'indkey', 'references_table_name',
|
'conkey', 'indkey', 'references_table_name',
|
||||||
'refnspoid']
|
'refnspoid']
|
||||||
|
|
||||||
trigger_keys_to_ignore = ['xmin', 'tgrelid', 'tgfoid', 'tfunction',
|
trigger_keys_to_ignore = ['xmin', 'tgrelid', 'tgfoid', 'tgqual',
|
||||||
'tgqual', 'tgconstraint']
|
'tgconstraint']
|
||||||
index_keys_to_ignore = ['indrelid', 'indclass']
|
index_keys_to_ignore = ['indrelid', 'indclass']
|
||||||
|
|
||||||
keys_to_ignore = table_keys_to_ignore + column_keys_to_ignore + \
|
keys_to_ignore = table_keys_to_ignore + column_keys_to_ignore + \
|
||||||
|
|
|
@ -3,7 +3,7 @@ ALTER TRIGGER {{ conn|qtIdent(o_data.name) }} ON {{ conn|qtIdent(o_data.nspname,
|
||||||
RENAME TO {{ conn|qtIdent(data.name) }};
|
RENAME TO {{ conn|qtIdent(data.name) }};
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ((data.prosrc is defined or data.is_row_trigger is defined or data.evnt_insert is defined or data.evnt_delete is defined or data.evnt_update is defined or data.fires is defined or data.is_constraint_trigger is defined or data.whenclause is defined) and (o_data.prosrc != data.prosrc or data.is_row_trigger != o_data.is_row_trigger or data.evnt_insert != o_data.evnt_insert or data.evnt_delete != o_data.evnt_delete or data.evnt_update != o_data.evnt_update or o_data.fires != data.fires or data.is_constraint_trigger != o_data.is_constraint_trigger or data.whenclause != o_data.whenclause)) %}
|
{% if ((data.tfunction is defined or data.is_row_trigger is defined or data.evnt_insert is defined or data.evnt_delete is defined or data.evnt_update is defined or data.fires is defined or data.is_constraint_trigger is defined or data.whenclause is defined) and (o_data.tfunction != data.tfunction or data.is_row_trigger != o_data.is_row_trigger or data.evnt_insert != o_data.evnt_insert or data.evnt_delete != o_data.evnt_delete or data.evnt_update != o_data.evnt_update or o_data.fires != data.fires or data.is_constraint_trigger != o_data.is_constraint_trigger or data.whenclause != o_data.whenclause)) %}
|
||||||
{% set or_flag = False %}
|
{% set or_flag = False %}
|
||||||
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
|
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
|
||||||
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
|
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
|
||||||
|
|
|
@ -3,7 +3,7 @@ ALTER TRIGGER {{ conn|qtIdent(o_data.name) }} ON {{ conn|qtIdent(o_data.nspname,
|
||||||
RENAME TO {{ conn|qtIdent(data.name) }};
|
RENAME TO {{ conn|qtIdent(data.name) }};
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ((data.prosrc is defined or data.is_row_trigger is defined or data.evnt_insert is defined or data.evnt_delete is defined or data.evnt_update is defined or data.fires is defined or data.is_constraint_trigger is defined or data.whenclause is defined) and (o_data.prosrc != data.prosrc or data.is_row_trigger != o_data.is_row_trigger or data.evnt_insert != o_data.evnt_insert or data.evnt_delete != o_data.evnt_delete or data.evnt_update != o_data.evnt_update or o_data.fires != data.fires or data.is_constraint_trigger != o_data.is_constraint_trigger or data.whenclause != o_data.whenclause)) %}
|
{% if ((data.tfunction is defined or data.is_row_trigger is defined or data.evnt_insert is defined or data.evnt_delete is defined or data.evnt_update is defined or data.fires is defined or data.is_constraint_trigger is defined or data.whenclause is defined) and (o_data.tfunction != data.tfunction or data.is_row_trigger != o_data.is_row_trigger or data.evnt_insert != o_data.evnt_insert or data.evnt_delete != o_data.evnt_delete or data.evnt_update != o_data.evnt_update or o_data.fires != data.fires or data.is_constraint_trigger != o_data.is_constraint_trigger or data.whenclause != o_data.whenclause)) %}
|
||||||
{% set or_flag = False %}
|
{% set or_flag = False %}
|
||||||
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
|
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
|
||||||
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
|
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SELECT t.oid,t.tgname AS name, t.xmin, t.tgenabled AS is_enable_trigger, t.*, relname, CASE WHEN relkind = 'r' THEN TRUE ELSE FALSE END AS parentistable,
|
SELECT t.oid,t.tgname AS name, t.xmin, t.tgenabled AS is_enable_trigger, t.*, relname, CASE WHEN relkind = 'r' THEN TRUE ELSE FALSE END AS parentistable,
|
||||||
nspname, des.description, l.lanname, p.prosrc, p.proname AS tfunction,
|
nspname, des.description, l.lanname, p.proname AS tfunction,
|
||||||
COALESCE(pg_catalog.substring(pg_catalog.pg_get_triggerdef(t.oid, true), 'WHEN (.*) EXECUTE (PROCEDURE|FUNCTION)'),
|
COALESCE(pg_catalog.substring(pg_catalog.pg_get_triggerdef(t.oid, true), 'WHEN (.*) EXECUTE (PROCEDURE|FUNCTION)'),
|
||||||
pg_catalog.substring(pg_catalog.pg_get_triggerdef(t.oid, true), 'WHEN (.*) \$trigger')) AS whenclause,
|
pg_catalog.substring(pg_catalog.pg_get_triggerdef(t.oid, true), 'WHEN (.*) \$trigger')) AS whenclause,
|
||||||
-- We need to convert tgargs column bytea datatype to array datatype
|
-- We need to convert tgargs column bytea datatype to array datatype
|
||||||
|
|
|
@ -3,7 +3,7 @@ ALTER TRIGGER {{ conn|qtIdent(o_data.name) }} ON {{ conn|qtIdent(o_data.nspname,
|
||||||
RENAME TO {{ conn|qtIdent(data.name) }};
|
RENAME TO {{ conn|qtIdent(data.name) }};
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ((data.prosrc is defined or data.is_row_trigger is defined or data.evnt_insert is defined or data.evnt_delete is defined or data.evnt_update is defined or data.fires is defined or data.is_constraint_trigger is defined or data.whenclause is defined) and (o_data.prosrc != data.prosrc or data.is_row_trigger != o_data.is_row_trigger or data.evnt_insert != o_data.evnt_insert or data.evnt_delete != o_data.evnt_delete or data.evnt_update != o_data.evnt_update or o_data.fires != data.fires or data.is_constraint_trigger != o_data.is_constraint_trigger or data.whenclause != o_data.whenclause)) %}
|
{% if ((data.tfunction is defined or data.is_row_trigger is defined or data.evnt_insert is defined or data.evnt_delete is defined or data.evnt_update is defined or data.fires is defined or data.is_constraint_trigger is defined or data.whenclause is defined) and (o_data.tfunction != data.tfunction or data.is_row_trigger != o_data.is_row_trigger or data.evnt_insert != o_data.evnt_insert or data.evnt_delete != o_data.evnt_delete or data.evnt_update != o_data.evnt_update or o_data.fires != data.fires or data.is_constraint_trigger != o_data.is_constraint_trigger or data.whenclause != o_data.whenclause)) %}
|
||||||
{% set or_flag = False %}
|
{% set or_flag = False %}
|
||||||
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
|
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
|
||||||
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
|
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
|
||||||
|
|
|
@ -3,7 +3,7 @@ ALTER TRIGGER {{ conn|qtIdent(o_data.name) }} ON {{ conn|qtIdent(o_data.nspname,
|
||||||
RENAME TO {{ conn|qtIdent(data.name) }};
|
RENAME TO {{ conn|qtIdent(data.name) }};
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ((data.prosrc is defined or data.is_row_trigger is defined or data.evnt_insert is defined or data.evnt_delete is defined or data.evnt_update is defined or data.fires is defined or data.is_constraint_trigger is defined or data.whenclause is defined) and (o_data.prosrc != data.prosrc or data.is_row_trigger != o_data.is_row_trigger or data.evnt_insert != o_data.evnt_insert or data.evnt_delete != o_data.evnt_delete or data.evnt_update != o_data.evnt_update or o_data.fires != data.fires or data.is_constraint_trigger != o_data.is_constraint_trigger or data.whenclause != o_data.whenclause)) %}
|
{% if ((data.tfunction is defined or data.is_row_trigger is defined or data.evnt_insert is defined or data.evnt_delete is defined or data.evnt_update is defined or data.fires is defined or data.is_constraint_trigger is defined or data.whenclause is defined) and (o_data.tfunction != data.tfunction or data.is_row_trigger != o_data.is_row_trigger or data.evnt_insert != o_data.evnt_insert or data.evnt_delete != o_data.evnt_delete or data.evnt_update != o_data.evnt_update or o_data.fires != data.fires or data.is_constraint_trigger != o_data.is_constraint_trigger or data.whenclause != o_data.whenclause)) %}
|
||||||
{% set or_flag = False %}
|
{% set or_flag = False %}
|
||||||
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
|
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
|
||||||
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
|
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SELECT t.oid,t.tgname AS name, t.xmin, t.tgenabled AS is_enable_trigger, t.*, relname, CASE WHEN relkind = 'r' THEN TRUE ELSE FALSE END AS parentistable,
|
SELECT t.oid,t.tgname AS name, t.xmin, t.tgenabled AS is_enable_trigger, t.*, relname, CASE WHEN relkind = 'r' THEN TRUE ELSE FALSE END AS parentistable,
|
||||||
nspname, des.description, l.lanname, p.prosrc, p.proname AS tfunction,
|
nspname, des.description, l.lanname, p.proname AS tfunction,
|
||||||
COALESCE(pg_catalog.substring(pg_catalog.pg_get_triggerdef(t.oid, true), 'WHEN (.*) EXECUTE (PROCEDURE|FUNCTION)'),
|
COALESCE(pg_catalog.substring(pg_catalog.pg_get_triggerdef(t.oid, true), 'WHEN (.*) EXECUTE (PROCEDURE|FUNCTION)'),
|
||||||
pg_catalog.substring(pg_catalog.pg_get_triggerdef(t.oid, true), 'WHEN (.*) \$trigger')) AS whenclause,
|
pg_catalog.substring(pg_catalog.pg_get_triggerdef(t.oid, true), 'WHEN (.*) \$trigger')) AS whenclause,
|
||||||
-- We need to convert tgargs column bytea datatype to array datatype
|
-- We need to convert tgargs column bytea datatype to array datatype
|
||||||
|
|
|
@ -3,7 +3,7 @@ ALTER TRIGGER {{ conn|qtIdent(o_data.name) }} ON {{ conn|qtIdent(o_data.nspname,
|
||||||
RENAME TO {{ conn|qtIdent(data.name) }};
|
RENAME TO {{ conn|qtIdent(data.name) }};
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ((data.prosrc is defined or data.is_row_trigger is defined or data.evnt_insert is defined or data.evnt_delete is defined or data.evnt_update is defined or data.fires is defined or data.is_constraint_trigger is defined or data.whenclause is defined) and (o_data.prosrc != data.prosrc or data.is_row_trigger != o_data.is_row_trigger or data.evnt_insert != o_data.evnt_insert or data.evnt_delete != o_data.evnt_delete or data.evnt_update != o_data.evnt_update or o_data.fires != data.fires or data.is_constraint_trigger != o_data.is_constraint_trigger or data.whenclause != o_data.whenclause)) %}
|
{% if ((data.tfunction is defined or data.is_row_trigger is defined or data.evnt_insert is defined or data.evnt_delete is defined or data.evnt_update is defined or data.fires is defined or data.is_constraint_trigger is defined or data.whenclause is defined) and (o_data.tfunction != data.tfunction or data.is_row_trigger != o_data.is_row_trigger or data.evnt_insert != o_data.evnt_insert or data.evnt_delete != o_data.evnt_delete or data.evnt_update != o_data.evnt_update or o_data.fires != data.fires or data.is_constraint_trigger != o_data.is_constraint_trigger or data.whenclause != o_data.whenclause)) %}
|
||||||
{% set or_flag = False %}
|
{% set or_flag = False %}
|
||||||
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
|
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
|
||||||
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
|
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SELECT t.oid,t.tgname AS name, t.xmin, t.tgenabled AS is_enable_trigger, t.*, relname, CASE WHEN relkind = 'r' THEN TRUE ELSE FALSE END AS parentistable,
|
SELECT t.oid,t.tgname AS name, t.xmin, t.tgenabled AS is_enable_trigger, t.*, relname, CASE WHEN relkind = 'r' THEN TRUE ELSE FALSE END AS parentistable,
|
||||||
nspname, des.description, l.lanname, p.prosrc, p.proname AS tfunction,
|
nspname, des.description, l.lanname, p.proname AS tfunction,
|
||||||
COALESCE(pg_catalog.substring(pg_catalog.pg_get_triggerdef(t.oid, true), 'WHEN (.*) EXECUTE (PROCEDURE|FUNCTION)'),
|
COALESCE(pg_catalog.substring(pg_catalog.pg_get_triggerdef(t.oid, true), 'WHEN (.*) EXECUTE (PROCEDURE|FUNCTION)'),
|
||||||
pg_catalog.substring(pg_catalog.pg_get_triggerdef(t.oid, true), 'WHEN (.*) \$trigger')) AS whenclause,
|
pg_catalog.substring(pg_catalog.pg_get_triggerdef(t.oid, true), 'WHEN (.*) \$trigger')) AS whenclause,
|
||||||
-- We need to convert tgargs column bytea datatype to array datatype
|
-- We need to convert tgargs column bytea datatype to array datatype
|
||||||
|
|
|
@ -3,7 +3,7 @@ ALTER TRIGGER {{ conn|qtIdent(o_data.name) }} ON {{ conn|qtIdent(o_data.nspname,
|
||||||
RENAME TO {{ conn|qtIdent(data.name) }};
|
RENAME TO {{ conn|qtIdent(data.name) }};
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ((data.prosrc is defined or data.is_row_trigger is defined or data.evnt_insert is defined or data.evnt_delete is defined or data.evnt_update is defined or data.fires is defined or data.is_constraint_trigger is defined or data.whenclause is defined) and (o_data.prosrc != data.prosrc or data.is_row_trigger != o_data.is_row_trigger or data.evnt_insert != o_data.evnt_insert or data.evnt_delete != o_data.evnt_delete or data.evnt_update != o_data.evnt_update or o_data.fires != data.fires or data.is_constraint_trigger != o_data.is_constraint_trigger or data.whenclause != o_data.whenclause)) %}
|
{% if ((data.tfunction is defined or data.is_row_trigger is defined or data.evnt_insert is defined or data.evnt_delete is defined or data.evnt_update is defined or data.fires is defined or data.is_constraint_trigger is defined or data.whenclause is defined) and (o_data.tfunction != data.tfunction or data.is_row_trigger != o_data.is_row_trigger or data.evnt_insert != o_data.evnt_insert or data.evnt_delete != o_data.evnt_delete or data.evnt_update != o_data.evnt_update or o_data.fires != data.fires or data.is_constraint_trigger != o_data.is_constraint_trigger or data.whenclause != o_data.whenclause)) %}
|
||||||
{% set or_flag = False %}
|
{% set or_flag = False %}
|
||||||
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
|
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
|
||||||
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
|
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
|
||||||
|
|
|
@ -457,6 +457,7 @@ def compare_database(params):
|
||||||
This function will compare the two databases.
|
This function will compare the two databases.
|
||||||
"""
|
"""
|
||||||
# Check the pre validation before compare
|
# Check the pre validation before compare
|
||||||
|
SchemaDiffRegistry.set_schema_diff_compare_mode('Database Objects')
|
||||||
status, error_msg, diff_model_obj, session_obj = \
|
status, error_msg, diff_model_obj, session_obj = \
|
||||||
compare_pre_validation(params['trans_id'], params['source_sid'],
|
compare_pre_validation(params['trans_id'], params['source_sid'],
|
||||||
params['target_sid'])
|
params['target_sid'])
|
||||||
|
@ -606,6 +607,7 @@ def compare_schema(params):
|
||||||
This function will compare the two schema.
|
This function will compare the two schema.
|
||||||
"""
|
"""
|
||||||
# Check the pre validation before compare
|
# Check the pre validation before compare
|
||||||
|
SchemaDiffRegistry.set_schema_diff_compare_mode('Schema Objects')
|
||||||
status, error_msg, diff_model_obj, session_obj = \
|
status, error_msg, diff_model_obj, session_obj = \
|
||||||
compare_pre_validation(params['trans_id'], params['source_sid'],
|
compare_pre_validation(params['trans_id'], params['source_sid'],
|
||||||
params['target_sid'])
|
params['target_sid'])
|
||||||
|
|
|
@ -15,6 +15,7 @@ class SchemaDiffRegistry():
|
||||||
It is more of a registry for different type of nodes for schema diff.
|
It is more of a registry for different type of nodes for schema diff.
|
||||||
"""
|
"""
|
||||||
_registered_nodes = dict()
|
_registered_nodes = dict()
|
||||||
|
_schema_diff_compare_mode = None
|
||||||
|
|
||||||
def __init__(self, node_name, node_view, parent_node='schema'):
|
def __init__(self, node_name, node_view, parent_node='schema'):
|
||||||
if node_name not in SchemaDiffRegistry._registered_nodes:
|
if node_name not in SchemaDiffRegistry._registered_nodes:
|
||||||
|
@ -59,3 +60,11 @@ class SchemaDiffRegistry():
|
||||||
if not module:
|
if not module:
|
||||||
return None
|
return None
|
||||||
return module(**cmd)
|
return module(**cmd)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def set_schema_diff_compare_mode(cls, mode):
|
||||||
|
cls._schema_diff_compare_mode = mode
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_schema_diff_compare_mode(cls):
|
||||||
|
return cls._schema_diff_compare_mode
|
||||||
|
|
Loading…
Reference in New Issue