Added 'OR REPLACE' clause while creating trigger. #6370

This commit is contained in:
Pravesh Sharma 2023-06-21 11:13:53 +05:30 committed by GitHub
parent 466e969776
commit 595a0dfc55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 1812 additions and 278 deletions

View File

@ -0,0 +1,12 @@
-- Constraint: UC_$%{}[]()&*^!@"'`\/#a
-- ALTER TABLE IF EXISTS testschema.tablefor_unique_cons DROP CONSTRAINT IF EXISTS "UC_$%{}[]()&*^!@""'`\/#a";
ALTER TABLE IF EXISTS testschema.tablefor_unique_cons
ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" UNIQUE NULLS NOT DISTINCT (col1)
INCLUDE (col2)
WITH (FILLFACTOR=90)
DEFERRABLE INITIALLY DEFERRED;
COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_unique_cons
IS 'Comment for alter';

View File

@ -0,0 +1,12 @@
-- Constraint: UC_$%{}[]()&*^!@"'`\/#a
-- ALTER TABLE IF EXISTS testschema.tablefor_unique_cons DROP CONSTRAINT IF EXISTS "UC_$%{}[]()&*^!@""'`\/#a";
ALTER TABLE IF EXISTS testschema.tablefor_unique_cons
ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" UNIQUE NULLS NOT DISTINCT (col1)
INCLUDE (col2)
DEFERRABLE INITIALLY DEFERRED;
COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_unique_cons
IS 'Comment for alter';

View File

@ -0,0 +1,132 @@
{
"scenarios": [
{
"type": "create",
"name": "Create Table",
"endpoint": "NODE-table.obj",
"sql_endpoint": "NODE-table.sql_id",
"data": {
"name": "tablefor_primary_key_cons",
"columns": [{
"name": "col1",
"cltype": "integer",
"is_primary_key": false
}, {
"name": "col2",
"cltype": "integer",
"is_primary_key": false
}],
"is_partitioned": false,
"schema": "testschema",
"spcname": "pg_default"
},
"store_object_id": true
}, {
"type": "create",
"name": "Create Index",
"endpoint": "NODE-index.obj",
"sql_endpoint": "NODE-index.sql_id",
"data": {
"name": "uindex",
"spcname": "pg_default",
"amname": "btree",
"columns": [{
"colname": "col1",
"sort_order": false,
"nulls": false,
"is_sort_nulls_applicable": true
}],
"indisunique": true,
"fillfactor": 20
}
}, {
"type": "create",
"name": "Create Primary Key Constraint -- 15 Plus",
"endpoint": "NODE-primary_key.obj",
"sql_endpoint": "NODE-primary_key.sql_id",
"msql_endpoint": "NODE-primary_key.msql",
"data": {
"name": "Pk_$%{}[]()&*^!@\"'`\\/#",
"comment": "Comment for create",
"fillfactor": 20,
"columns": [{"column":"col1"}],
"include": ["col2"],
"condeferrable": true,
"condeferred": true
},
"expected_sql_file": "create_pkey_constraint.sql",
"expected_msql_file": "create_pkey_constraint_msql.sql"
}, {
"type": "alter",
"name": "Alter Primary Key Constraint -- 15 Plus",
"endpoint": "NODE-primary_key.obj_id",
"sql_endpoint": "NODE-primary_key.sql_id",
"msql_endpoint": "NODE-primary_key.msql_id",
"data": {
"name": "Pk_$%{}[]()&*^!@\"'`\\/#a",
"fillfactor": 90,
"comment": "Comment for alter"
},
"expected_sql_file": "alter_pkey_constraint.sql",
"expected_msql_file": "alter_pkey_constraint_msql.sql"
}, {
"type": "alter",
"name": "Alter Primary Key Constraint Reset Fill factor",
"endpoint": "NODE-primary_key.obj_id",
"sql_endpoint": "NODE-primary_key.sql_id",
"msql_endpoint": "NODE-primary_key.msql_id",
"data": {
"fillfactor": ""
},
"expected_sql_file": "alter_pkey_reset_fillfactor.sql",
"expected_msql_file": "alter_pkey_reset_fillfactor_msql.sql"
}, {
"type": "delete",
"name": "Drop Primary Key Constraint -- 15 plus",
"endpoint": "NODE-primary_key.delete_id",
"data": {
"name": "Pk_$%{}[]()&*^!@\"'`\\/#a"
}
}, {
"type": "create",
"name": "Create Primary Key Constraint with Index -- 15 plus",
"endpoint": "NODE-primary_key.obj",
"sql_endpoint": "NODE-primary_key.sql_id",
"msql_endpoint": "NODE-primary_key.msql",
"data": {
"name": "Pk_$%{}[]()&*^!@\"'`\\/#",
"comment": "Comment for create",
"index": "uindex"
},
"expected_sql_file": "create_pkey_constraint_with_index.sql",
"expected_msql_file": "create_pkey_constraint_with_index_msql.sql"
}, {
"type": "alter",
"name": "Alter Primary Key Constraint with Index -- 15 plus",
"endpoint": "NODE-primary_key.obj_id",
"sql_endpoint": "NODE-primary_key.sql_id",
"msql_endpoint": "NODE-primary_key.msql_id",
"data": {
"name": "Pk_$%{}[]()&*^!@\"'`\\/#a",
"fillfactor": 90,
"comment": "Comment for alter"
},
"expected_sql_file": "alter_pkey_constraint_with_index.sql",
"expected_msql_file": "alter_pkey_constraint_with_index_msql.sql"
}, {
"type": "delete",
"name": "Drop Primary Key Constraint with Index -- 15 plus",
"endpoint": "NODE-primary_key.delete_id",
"data": {
"name": "Pk_$%{}[]()&*^!@\"'`\\/#a"
}
}, {
"type": "delete",
"name": "Drop Index Constraint Table -- 15 plus",
"endpoint": "NODE-table.delete_id",
"data": {
"name": "tablefor_primary_key_cons"
}
}
]
}

View File

@ -57,6 +57,63 @@
},
"expected_sql_file": "create_unique_constraint.sql",
"expected_msql_file": "create_unique_constraint_msql.sql"
}, {
"type": "alter",
"name": "Alter Unique Constraint -- 15 Plus",
"endpoint": "NODE-unique_constraint.obj_id",
"sql_endpoint": "NODE-unique_constraint.sql_id",
"msql_endpoint": "NODE-unique_constraint.msql_id",
"data": {
"name": "UC_$%{}[]()&*^!@\"'`\\/#a",
"fillfactor": 90,
"comment": "Comment for alter"
},
"expected_sql_file": "alter_unique_constraint.sql",
"expected_msql_file": "alter_unique_constraint_msql.sql"
}, {
"type": "alter",
"name": "Alter Unique Constraint Reset Fill factor -- 15 Plus",
"endpoint": "NODE-unique_constraint.obj_id",
"sql_endpoint": "NODE-unique_constraint.sql_id",
"msql_endpoint": "NODE-unique_constraint.msql_id",
"data": {
"fillfactor": ""
},
"expected_sql_file": "alter_unique_reset_fillfactor.sql",
"expected_msql_file": "alter_unique_reset_fillfactor_msql.sql"
}, {
"type": "delete",
"name": "Drop Unique Constraint -- 15 Plus",
"endpoint": "NODE-unique_constraint.delete_id",
"data": {
"name": "UC_$%{}[]()&*^!@\"'`\\/#a"
}
}, {
"type": "create",
"name": "Create Unique Constraint with Index -- 15 Plus",
"endpoint": "NODE-unique_constraint.obj",
"sql_endpoint": "NODE-unique_constraint.sql_id",
"msql_endpoint": "NODE-unique_constraint.msql",
"data": {
"name": "UC_$%{}[]()&*^!@\"'`\\/#",
"comment": "Comment for create",
"index": "uindex"
},
"expected_sql_file": "create_unique_constraint_with_index.sql",
"expected_msql_file": "create_unique_constraint_with_index_msql.sql"
}, {
"type": "alter",
"name": "Alter Unique Constraint with Index -- 15 Plus",
"endpoint": "NODE-unique_constraint.obj_id",
"sql_endpoint": "NODE-unique_constraint.sql_id",
"msql_endpoint": "NODE-unique_constraint.msql_id",
"data": {
"name": "UC_$%{}[]()&*^!@\"'`\\/#a",
"fillfactor": 90,
"comment": "Comment for alter"
},
"expected_sql_file": "alter_unique_constraint_with_index.sql",
"expected_msql_file": "alter_unique_constraint_with_index_msql.sql"
}, {
"type": "delete",
"name": "Drop Unique Constraint -- 15 Plus",
@ -73,5 +130,4 @@
}
}
]
}
}

View File

@ -0,0 +1,16 @@
-- Index: Idx1_$%{}[]()&*^!@"'`\/#
-- DROP INDEX IF EXISTS public."Idx1_$%{}[]()&*^!@""'`\/#";
CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#"
ON public.test_table_for_indexes USING btree
(id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST)
NULLS NOT DISTINCT
WITH (FILLFACTOR=10)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.test_table_for_indexes
CLUSTER ON "Idx1_$%{}[]()&*^!@""'`\/#";
COMMENT ON INDEX public."Idx1_$%{}[]()&*^!@""'`\/#"
IS 'Test Comment';

View File

@ -0,0 +1,12 @@
-- Index: Idx1_$%{}[]()&*^!@"'`\/#
-- DROP INDEX IF EXISTS public."Idx1_$%{}[]()&*^!@""'`\/#";
CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#"
ON public.test_table_for_indexes USING btree
(id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST)
NULLS NOT DISTINCT
TABLESPACE pg_default;
COMMENT ON INDEX public."Idx1_$%{}[]()&*^!@""'`\/#"
IS 'Test Comment';

View File

@ -59,7 +59,7 @@
},
{
"type": "delete",
"name": "Drop index -- 15 Plus",
"name": "Drop index",
"endpoint": "NODE-index.delete_id",
"data": {
"name": "Idx_$%{}[]()&*^!@\"'`\\/#"
@ -186,6 +186,34 @@
"expected_sql_file": "create_btree_desc_null_first.sql",
"expected_msql_file": "create_btree_desc_null_first_msql.sql"
},
{
"type": "alter",
"name": "Alter index name, fill factor, comment and clustered -- 15 Plus",
"endpoint": "NODE-index.obj_id",
"sql_endpoint": "NODE-index.sql_id",
"msql_endpoint": "NODE-index.msql_id",
"data": {
"name": "Idx1_$%{}[]()&*^!@\"'`\\/#",
"description":"Test Comment",
"fillfactor":"10",
"indisclustered":true
},
"expected_sql_file": "alter_name_fillfactor_comment.sql",
"expected_msql_file": "alter_name_fillfactor_comment_msql.sql"
},
{
"type": "alter",
"name": "Alter reset fill factor and cluster -- 15 Plus",
"endpoint": "NODE-index.obj_id",
"sql_endpoint": "NODE-index.sql_id",
"msql_endpoint": "NODE-index.msql_id",
"data": {
"fillfactor": "",
"indisclustered": false
},
"expected_sql_file": "alter_reset_fillfactor_cluster.sql",
"expected_msql_file": "alter_reset_fillfactor_cluster_msql.sql"
},
{
"type": "delete",
"name": "Drop index -- 15 Plus",
@ -194,6 +222,39 @@
"name": "Idx1_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create hash index -- 15 Plus",
"endpoint": "NODE-index.obj",
"sql_endpoint": "NODE-index.sql_id",
"msql_endpoint": "NODE-index.msql",
"data": {
"name": "Idx_$%{}[]()&*^!@\"'`\\/#",
"spcname": "pg_default",
"amname": "hash",
"columns": [{
"colname": "id",
"collspcname": "",
"op_class": "",
"sort_order": false,
"nulls": false,
"is_sort_nulls_applicable": false
}],
"indisunique": false,
"indisclustered": false,
"isconcurrent": false
},
"expected_sql_file": "create_hash_index.sql",
"expected_msql_file": "create_hash_index_msql.sql"
},
{
"type": "delete",
"name": "Drop hash index -- 15 Plus",
"endpoint": "NODE-index.delete_id",
"data": {
"name": "Idx_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "delete",
"name": "Drop Table",
@ -201,7 +262,33 @@
"data": {
"name": "test_table_for_indexes"
}
},
{
"type": "create",
"name": "Create unnamed hash index -- 15 Plus",
"endpoint": "NODE-index.obj",
"sql_endpoint": "NODE-index.sql_id",
"msql_endpoint": "NODE-index.msql",
"data": {
"spcname": "pg_default",
"amname": "hash",
"columns": [{
"colname": "id",
"collspcname": "",
"op_class": "",
"sort_order": false,
"nulls": false,
"is_sort_nulls_applicable": false
}],
"indisunique": false,
"isconcurrent": false
},
"expected_msql_file": "create_unnamed_hash_index_msql.sql"
},
{
"type": "delete",
"name": "Drop hash index -- 15 Plus",
"endpoint": "NODE-index.delete_id"
}
]
}
}

View File

@ -0,0 +1,37 @@
{### Set a flag which allows us to put OR between events ###}
{% set or_flag = False %}
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
{% else %}
CREATE{% if not data.is_constraint_trigger %} OR REPLACE{% endif %}{% if data.is_constraint_trigger %} CONSTRAINT{% endif %} TRIGGER {{ conn|qtIdent(data.name) }}
{% endif %}
{{data.fires}} {% if data.evnt_insert %}INSERT{% set or_flag = True %}
{% endif %}{% if data.evnt_delete %}
{% if or_flag %} OR {% endif %}DELETE{% set or_flag = True %}
{% endif %}{% if data.evnt_truncate %}
{% if or_flag %} OR {% endif %}TRUNCATE{% set or_flag = True %}
{% endif %}{% if data.evnt_update %}
{% if or_flag %} OR {% endif %}UPDATE {% if data.columns|length > 0 %}OF {% for c in data.columns %}{% if loop.index != 1 %}, {% endif %}{{ conn|qtIdent(c) }}{% endfor %}{% endif %}
{% endif %}
ON {{ conn|qtIdent(data.schema, data.table) }}
{% if data.tgdeferrable %}
DEFERRABLE{% if data.tginitdeferred %} INITIALLY DEFERRED{% endif %}
{% endif %}
{% if data.tgoldtable or data.tgnewtable %}
REFERENCING{% if data.tgnewtable %} NEW TABLE AS {{ conn|qtIdent(data.tgnewtable) }}{% endif %}{% if data.tgoldtable %} OLD TABLE AS {{ conn|qtIdent(data.tgoldtable) }}{% endif %}
{% endif %}
FOR EACH{% if data.is_row_trigger %} ROW{% else %} STATEMENT{% endif %}
{% if data.whenclause %}
WHEN {% if not data.oid %}({% endif %}{{ data.whenclause }}{% if not data.oid %}){% endif %}{% endif %}
{% if data.prosrc is defined and
(data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL') %}{{ data.prosrc }}{% else %}EXECUTE FUNCTION {{ data.tfunction }}{% if data.tgargs %}({{ data.tgargs }}){% else %}(){% endif%}{% endif%};
{% if data.description %}
COMMENT ON TRIGGER {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(data.schema, data.table) }}
IS {{data.description|qtLiteral(conn)}};
{% endif %}

View File

@ -0,0 +1,61 @@
{% if data.name and o_data.name != data.name %}
ALTER TRIGGER {{ conn|qtIdent(o_data.name) }} ON {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
RENAME TO {{ conn|qtIdent(data.name) }};
{% 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)) %}
{% set or_flag = False %}
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
{% else %}
CREATE{% if not data.is_constraint_trigger %} OR REPLACE{% endif %}{% if data.is_constraint_trigger %} CONSTRAINT{% endif %} TRIGGER {{ conn|qtIdent(data.name) }}
{% endif %}
{% if data.fires is defined %}{{data.fires}} {% else %}{{o_data.fires}} {% endif %}{% if data.evnt_insert is not defined %}{% if o_data.evnt_insert %}INSERT{% set or_flag = True %}
{% endif %}{% else %}{% if data.evnt_insert %}INSERT{% set or_flag = True %}{% endif %}{% endif %}{% if data.evnt_delete is not defined %}{% if o_data.evnt_delete %}
{% if or_flag %} OR {% endif %}DELETE{% set or_flag = True %}
{% endif %}{% else %}{% if data.evnt_delete %}
{% if or_flag %} OR {% endif %}DELETE{% set or_flag = True %}{%endif %}{% endif %}{% if data.evnt_truncate is not defined %}{% if o_data.evnt_truncate %}
{% if or_flag %} OR {% endif %}TRUNCATE{% set or_flag = True %}
{% endif %}{% else %}{% if data.evnt_truncate %}
{% if or_flag %} OR {% endif %}TRUNCATE{% set or_flag = True %}{%endif %}{% endif %}{% if data.evnt_update is not defined %}{% if o_data.evnt_update %}
{% if or_flag %} OR {% endif %}UPDATE {% if o_data.columns|length > 0 %}OF {% for c in o_data.columns %}{% if loop.index != 1 %}, {% endif %}{{ conn|qtIdent(c) }}{% endfor %}{% endif %}
{% endif %}{% else %}{% if data.evnt_update %}
{% if or_flag %} OR {% endif %}UPDATE {% if data.columns|length > 0 %}OF {% for c in data.columns %}{% if loop.index != 1 %}, {% endif %}{{ conn|qtIdent(c) }}{% endfor %}{% endif %}{% endif %}
{% endif %}
ON {{ conn|qtIdent(data.schema, data.table) }}
{% if data.tgdeferrable %}
DEFERRABLE{% if data.tginitdeferred %} INITIALLY DEFERRED{% endif %}
{% elif o_data.tgdeferrable %}
DEFERRABLE{% if o_data.tginitdeferred %} INITIALLY DEFERRED{% endif %}
{% endif %}{% if data.is_row_trigger is not defined %}
FOR EACH{% if o_data.is_row_trigger %} ROW{% else %} STATEMENT{% endif %} {% else %}
FOR EACH{% if data.is_row_trigger %} ROW{% else %} STATEMENT{% endif %} {% endif %}
{% if data.whenclause %}
WHEN {{ data.whenclause }}
{% elif o_data.whenclause %}
WHEN {{ o_data.whenclause }}
{% endif %}
{% if (data.tfunction is defined) %}
EXECUTE FUNCTION {{ data.tfunction }}{% if data.tgargs %}({{ data.tgargs }}){% else %}(){% endif%};
{% else %}
EXECUTE FUNCTION {{ o_data.tfunction }}{% if o_data.tgargs %}({{ o_data.tgargs }}){% else %}(){% endif%};
{% endif %}
{% if data.description is not defined and o_data.description %}
COMMENT ON TRIGGER {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
IS {{o_data.description|qtLiteral(conn)}};
{% endif %}
{% endif %}
{% if data.description is defined and o_data.description != data.description %}
COMMENT ON TRIGGER {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
IS {{data.description|qtLiteral(conn)}};
{% endif %}
{% if data.is_enable_trigger is defined and o_data.is_enable_trigger != data.is_enable_trigger %}
{% set enable_map = {'R':'ENABLE REPLICA', 'A':'ENABLE ALWAYS', 'O':'ENABLE', 'D':'DISABLE'} %}
ALTER TABLE {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
{{ enable_map[data.is_enable_trigger] }} TRIGGER {{ conn|qtIdent(data.name) }};
{% endif %}

View File

@ -0,0 +1,37 @@
{### Set a flag which allows us to put OR between events ###}
{% set or_flag = False %}
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
{% else %}
CREATE{% if not data.is_constraint_trigger %} OR REPLACE{% endif %}{% if data.is_constraint_trigger %} CONSTRAINT{% endif %} TRIGGER {{ conn|qtIdent(data.name) }}
{% endif %}
{{data.fires}} {% if data.evnt_insert %}INSERT{% set or_flag = True %}
{% endif %}{% if data.evnt_delete %}
{% if or_flag %} OR {% endif %}DELETE{% set or_flag = True %}
{% endif %}{% if data.evnt_truncate %}
{% if or_flag %} OR {% endif %}TRUNCATE{% set or_flag = True %}
{% endif %}{% if data.evnt_update %}
{% if or_flag %} OR {% endif %}UPDATE {% if data.columns|length > 0 %}OF {% for c in data.columns %}{% if loop.index != 1 %}, {% endif %}{{ conn|qtIdent(c) }}{% endfor %}{% endif %}
{% endif %}
ON {{ conn|qtIdent(data.schema, data.table) }}
{% if data.tgdeferrable %}
DEFERRABLE{% if data.tginitdeferred %} INITIALLY DEFERRED{% endif %}
{% endif %}
{% if data.tgoldtable or data.tgnewtable %}
REFERENCING{% if data.tgnewtable %} NEW TABLE AS {{ conn|qtIdent(data.tgnewtable) }}{% endif %}{% if data.tgoldtable %} OLD TABLE AS {{ conn|qtIdent(data.tgoldtable) }}{% endif %}
{% endif %}
FOR EACH{% if data.is_row_trigger %} ROW{% else %} STATEMENT{% endif %}
{% if data.whenclause %}
WHEN {% if not data.oid %}({% endif %}{{ data.whenclause }}{% if not data.oid %}){% endif %}{% endif %}
{% if data.prosrc is defined and
(data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL') %}{{ data.prosrc }}{% else %}EXECUTE FUNCTION {{ data.tfunction }}{% if data.tgargs %}({{ data.tgargs }}){% else %}(){% endif%}{% endif%};
{% if data.description %}
COMMENT ON TRIGGER {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(data.schema, data.table) }}
IS {{data.description|qtLiteral(conn)}};
{% endif %}

View File

@ -0,0 +1,70 @@
{% if data.name and o_data.name != data.name %}
ALTER TRIGGER {{ conn|qtIdent(o_data.name) }} ON {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
RENAME TO {{ conn|qtIdent(data.name) }};
{% 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)) %}
{% set or_flag = False %}
{% if data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL' %}
CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
{% else %}
CREATE{% if not data.is_constraint_trigger %} OR REPLACE{% endif %}{% if data.is_constraint_trigger %} CONSTRAINT{% endif %} TRIGGER {{ conn|qtIdent(data.name) }}
{% endif %}
{% if data.fires is defined %}{{data.fires}} {% else %}{{o_data.fires}} {% endif %}{% if data.evnt_insert is not defined %}{% if o_data.evnt_insert %}INSERT{% set or_flag = True %}
{% endif %}{% else %}{% if data.evnt_insert %}INSERT{% set or_flag = True %}{% endif %}{% endif %}{% if data.evnt_delete is not defined %}{% if o_data.evnt_delete %}
{% if or_flag %} OR {% endif %}DELETE{% set or_flag = True %}
{% endif %}{% else %}{% if data.evnt_delete %}
{% if or_flag %} OR {% endif %}DELETE{% set or_flag = True %}{%endif %}{% endif %}{% if data.evnt_truncate is not defined %}{% if o_data.evnt_truncate %}
{% if or_flag %} OR {% endif %}TRUNCATE{% set or_flag = True %}
{% endif %}{% else %}{% if data.evnt_truncate %}
{% if or_flag %} OR {% endif %}TRUNCATE{% set or_flag = True %}{%endif %}{% endif %}{% if data.evnt_update is not defined %}{% if o_data.evnt_update %}
{% if or_flag %} OR {% endif %}UPDATE {% if o_data.columns|length > 0 %}OF {% for c in o_data.columns %}{% if loop.index != 1 %}, {% endif %}{{ conn|qtIdent(c) }}{% endfor %}{% endif %}
{% endif %}{% else %}{% if data.evnt_update %}
{% if or_flag %} OR {% endif %}UPDATE {% if data.columns|length > 0 %}OF {% for c in data.columns %}{% if loop.index != 1 %}, {% endif %}{{ conn|qtIdent(c) }}{% endfor %}{% endif %}{% endif %}
{% endif %}
ON {{ conn|qtIdent(data.schema, data.table) }}
{% if data.tgdeferrable %}
DEFERRABLE{% if data.tginitdeferred %} INITIALLY DEFERRED{% endif %}
{% elif o_data.tgdeferrable %}
DEFERRABLE{% if o_data.tginitdeferred %} INITIALLY DEFERRED{% endif %}
{% endif %}{% if data.is_row_trigger is not defined %}
FOR EACH{% if o_data.is_row_trigger %} ROW{% else %} STATEMENT{% endif %} {% else %}
FOR EACH{% if data.is_row_trigger %} ROW{% else %} STATEMENT{% endif %} {% endif %}
{% if data.whenclause %}
WHEN {{ data.whenclause }}
{% elif o_data.whenclause %}
WHEN {{ o_data.whenclause }}
{% endif %}
{%if data.tfunction == 'Inline EDB-SPL' %}
{% if (data.prosrc is not defined) %}
{{ o_data.prosrc }};
{% else %}
{{ data.prosrc }};
{% endif %}
{% else %}
{% if (data.tfunction is defined) %}
EXECUTE FUNCTION {{ data.tfunction }}{% if data.tgargs %}({{ data.tgargs }}){% else %}(){% endif%};
{% else %}
EXECUTE FUNCTION {{ o_data.tfunction }}{% if o_data.tgargs %}({{ o_data.tgargs }}){% else %}(){% endif%};
{% endif %}
{% endif %}
{% if data.description is not defined and o_data.description %}
COMMENT ON TRIGGER {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
IS {{o_data.description|qtLiteral(conn)}};
{% endif %}
{% endif %}
{% if data.description is defined and o_data.description != data.description %}
COMMENT ON TRIGGER {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
IS {{data.description|qtLiteral(conn)}};
{% endif %}
{% if data.is_enable_trigger is defined and o_data.is_enable_trigger != data.is_enable_trigger %}
{% set enable_map = {'R':'ENABLE REPLICA', 'A':'ENABLE ALWAYS', 'O':'ENABLE', 'D':'DISABLE'} %}
ALTER TABLE {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
{{ enable_map[data.is_enable_trigger] }} TRIGGER {{ conn|qtIdent(data.name) }};
{% endif %}

View File

@ -0,0 +1,16 @@
-- Trigger: trig_after_delete_events_with_transition_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"
AFTER DELETE
ON public.tablefortrigger
REFERENCING OLD TABLE AS oldtab
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';
ALTER TABLE public.tablefortrigger
ENABLE ALWAYS TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#";

View File

@ -0,0 +1,16 @@
-- Trigger: trig_after_insert_events_with_transition_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"
AFTER INSERT
ON public.tablefortrigger
REFERENCING NEW TABLE AS inserted
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';
ALTER TABLE public.tablefortrigger
DISABLE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#";

View File

@ -0,0 +1,15 @@
-- Trigger: trig_test_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"
BEFORE INSERT
ON public.tablefortrigger
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';
ALTER TABLE public.tablefortrigger
DISABLE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#";

View File

@ -0,0 +1,16 @@
-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"
BEFORE UPDATE OF col1
ON public.tablefortrigger
FOR EACH ROW
WHEN (old.col2 IS DISTINCT FROM new.col2)
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';
ALTER TABLE public.tablefortrigger
ENABLE REPLICA TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#";

View File

@ -0,0 +1,13 @@
-- Trigger: trig_after_delete_events_with_transition_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"
AFTER DELETE
ON public.tablefortrigger
REFERENCING OLD TABLE AS oldtab
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,9 @@
CREATE OR REPLACE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"
AFTER DELETE
ON public.tablefortrigger
REFERENCING OLD TABLE AS oldtab
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,13 @@
-- Trigger: trig_after_insert_events_with_transition_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"
AFTER INSERT
ON public.tablefortrigger
REFERENCING NEW TABLE AS inserted
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,9 @@
CREATE OR REPLACE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"
AFTER INSERT
ON public.tablefortrigger
REFERENCING NEW TABLE AS inserted
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,12 @@
-- Trigger: trig_b4r_update_mul_events_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#"
BEFORE INSERT OR UPDATE OF col3
ON public.tablefortrigger
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'multiple event trigger';

View File

@ -0,0 +1,8 @@
CREATE OR REPLACE TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#"
BEFORE INSERT OR UPDATE OF col3
ON public.tablefortrigger
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'multiple event trigger';

View File

@ -0,0 +1,12 @@
-- Trigger: trig_test_statement_$%{}[]()&*^!@\"'`\\/#"
-- DROP TRIGGER IF EXISTS "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#"""
BEFORE INSERT OR DELETE OR TRUNCATE OR UPDATE OF col1, col2, col3
ON public.tablefortrigger
FOR EACH STATEMENT
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,8 @@
CREATE OR REPLACE TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#"""
BEFORE INSERT OR DELETE OR TRUNCATE OR UPDATE OF col1, col2, col3
ON public.tablefortrigger
FOR EACH STATEMENT
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,12 @@
-- Trigger: trig_test_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"
BEFORE INSERT
ON public.tablefortrigger
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,8 @@
CREATE OR REPLACE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"
BEFORE INSERT
ON public.tablefortrigger
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,13 @@
-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"
BEFORE UPDATE OF col1
ON public.tablefortrigger
FOR EACH ROW
WHEN (old.col2 IS DISTINCT FROM new.col2)
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,9 @@
CREATE OR REPLACE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"
BEFORE UPDATE OF col1
ON public.tablefortrigger
FOR EACH ROW
WHEN (OLD.col2 IS DISTINCT FROM NEW.col2)
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,312 @@
{
"scenarios": [
{
"type": "create",
"name": "Create Table",
"endpoint": "NODE-table.obj",
"sql_endpoint": "NODE-table.sql_id",
"data": {
"name": "tablefortrigger",
"columns": [
{
"name": "col1",
"cltype": "integer",
"is_primary_key": true
},
{
"name": "col2",
"cltype": "text"
},
{
"name": "col3",
"cltype": "integer"
}
],
"is_partitioned": false,
"schema": "public",
"spcname": "pg_default"
},
"store_object_id": true
},
{
"type": "create",
"name": "Create trigger function",
"endpoint": "NODE-trigger_function.obj",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"name": "Trig1_$%{}[]()&*^!@\"'`\\/#",
"acl": [],
"args": [],
"funcowner": "postgres",
"lanname": "plpgsql",
"options": [],
"pronamespace": 2200,
"prorettypename": "trigger",
"prosrc": "begin\nselect 1;\nend;",
"seclabels": [],
"variables": [],
"schema": "public"
},
"expected_sql_file": "create_plain_trigger_function.sql"
},
{
"type": "create",
"name": "Create before event trigger -- 14 Plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_test_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "BEFORE",
"evnt_truncate": false,
"description": "test comment",
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"evnt_insert": true
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_before_insert_event_trigger.sql",
"expected_msql_file": "create_before_insert_event_trigger_msql.sql"
},
{
"type": "alter",
"name": "Alter(disable) before event trigger",
"endpoint": "NODE-trigger.obj_id",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql_id",
"data": {
"name": "trig_test_$%{}[]()&*^!@\"'`\\/#",
"is_enable_trigger": "D"
},
"schema": "public",
"expected_sql_file": "alter_before_insert_event_trigger.sql",
"expected_msql_file": "alter_before_insert_event_trigger_msql.sql"
},
{
"type": "create",
"name": "Create before update event trigger -- 14 Plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "BEFORE",
"evnt_truncate": false,
"description": "test comment",
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"evnt_update": true,
"columns": "[\"col1\"]",
"whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2"
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_before_update_event_trigger.sql",
"expected_msql_file": "create_before_update_event_trigger_msql.sql"
},
{
"type": "alter",
"name": "Alter before update event trigger enable replica -- 14 Plus",
"endpoint": "NODE-trigger.obj_id",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql_id",
"data": {
"name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#",
"is_enable_trigger": "R"
},
"schema": "public",
"expected_sql_file": "alter_before_update_event_trigger_enable_replica.sql",
"expected_msql_file": "alter_before_update_event_trigger_enable_replica_msql.sql"
},
{
"type": "create",
"name": "Create after update event trigger -- 14 Plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "AFTER",
"evnt_truncate": false,
"description": "comment for update event trigger",
"is_constraint_trigger": true,
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"evnt_update": true,
"whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2",
"columns": "[\"col2\"]"
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_after_update_event_trigger.sql",
"expected_msql_file": "create_after_update_event_trigger_msql.sql"
},
{
"type": "alter",
"name": "Alter after update event trigger enable always -- 14 Plus",
"endpoint": "NODE-trigger.obj_id",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql_id",
"data": {
"name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#",
"is_enable_trigger": "A"
},
"schema": "public",
"expected_sql_file": "alter_after_update_event_trigger_enable_always.sql",
"expected_msql_file": "alter_after_update_event_trigger_enable_always_msql.sql"
},
{
"type": "create",
"name": "Create trigger on before for multiple events -- 14 Plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_b4r_update_mul_events_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "BEFORE",
"evnt_truncate": false,
"description": "multiple event trigger",
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"evnt_insert": true,
"evnt_update": true,
"columns": "[\"col3\"]",
"whenclause": ""
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_b4r_update_multiple_event_trigger.sql",
"expected_msql_file": "create_b4r_update_multiple_event_trigger_msql.sql"
},
{
"type": "create",
"name": "Create trigger on after delete event with arguments -- 14 Plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "AFTER",
"evnt_truncate": false,
"description": "delete event trig",
"is_constraint_trigger": true,
"tgdeferrable": true,
"tginitdeferred": true,
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"tgargs": "12",
"evnt_delete": true
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_after_delete_event_trigger.sql",
"expected_msql_file": "create_after_delete_event_trigger_msql.sql"
},
{
"type": "delete",
"name": "Delete trigger on after delete event with arguments -- 14 Plus",
"endpoint": "NODE-trigger.obj_id",
"sql_endpoint": "NODE-trigger.sql_id",
"data": {
"name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#"
},
"schema": "public"
},
{
"type": "create",
"name": "Create before event trigger at statement level -- 14 plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_test_statement_$%{}[]()&*^!@\\\"'`\\\\/#\"",
"is_row_trigger": false,
"fires": "BEFORE",
"evnt_truncate": true,
"description": "test comment",
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"evnt_insert": true,
"evnt_delete": true,
"evnt_update": true,
"whenclause": "",
"columns": "[\"col1\",\"col2\",\"col3\"]"
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_before_insert_event_at_statement.sql",
"expected_msql_file": "create_before_insert_event_at_statement_msql.sql"
},
{
"type": "create",
"name": "Create trigger on after insert event with transition -- 14 Plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_after_insert_events_with_transition_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "AFTER",
"evnt_truncate": false,
"description": "test comment",
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"evnt_insert": true,
"tgnewtable": "inserted"
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_after_insert_event_trigger_with_transition.sql",
"expected_msql_file": "create_after_insert_event_trigger_with_transition_msql.sql"
},
{
"type": "alter",
"name": "Alter(disable) trigger on after inset event with transition -- 14 Plus",
"endpoint": "NODE-trigger.obj_id",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql_id",
"data": {
"name": "trig_after_insert_events_with_transition_$%{}[]()&*^!@\"'`\\/#",
"is_enable_trigger": "D"
},
"schema": "public",
"expected_sql_file": "alter_after_insert_event_trigger_with_transition.sql",
"expected_msql_file": "alter_after_insert_event_trigger_with_transition_msql.sql"
},
{
"type": "create",
"name": "Create trigger on after delete event with transition -- 14 Plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_after_delete_events_with_transition_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "AFTER",
"evnt_truncate": false,
"description": "test comment",
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"is_constraint_trigger": false,
"evnt_delete": true,
"tgoldtable": "oldtab"
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_after_delete_event_trigger_with_transition.sql",
"expected_msql_file": "create_after_delete_event_trigger_with_transition_msql.sql"
},
{
"type": "alter",
"name": "Alter trigger on after delete event with transition always enable -- 14 Plus",
"endpoint": "NODE-trigger.obj_id",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql_id",
"data": {
"name": "trig_after_delete_events_with_transition_$%{}[]()&*^!@\"'`\\/#",
"is_enable_trigger": "A"
},
"schema": "public",
"expected_sql_file": "alter_after_delete_event_trigger_with_transition.sql",
"expected_msql_file": "alter_after_delete_event_trigger_with_transition_msql.sql"
}
]
}

View File

@ -0,0 +1,16 @@
-- Trigger: trig_after_delete_events_with_transition_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"
AFTER DELETE
ON public.tablefortrigger
REFERENCING OLD TABLE AS oldtab
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';
ALTER TABLE public.tablefortrigger
ENABLE ALWAYS TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#";

View File

@ -0,0 +1,16 @@
-- Trigger: trig_after_insert_events_with_transition_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"
AFTER INSERT
ON public.tablefortrigger
REFERENCING NEW TABLE AS inserted
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';
ALTER TABLE public.tablefortrigger
DISABLE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#";

View File

@ -0,0 +1,15 @@
-- Trigger: trig_test_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"
BEFORE INSERT
ON public.tablefortrigger
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';
ALTER TABLE public.tablefortrigger
DISABLE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#";

View File

@ -0,0 +1,16 @@
-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"
BEFORE UPDATE OF col1
ON public.tablefortrigger
FOR EACH ROW
WHEN (old.col2 IS DISTINCT FROM new.col2)
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';
ALTER TABLE public.tablefortrigger
ENABLE REPLICA TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#";

View File

@ -0,0 +1,13 @@
-- Trigger: trig_after_delete_events_with_transition_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"
AFTER DELETE
ON public.tablefortrigger
REFERENCING OLD TABLE AS oldtab
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,9 @@
CREATE OR REPLACE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"
AFTER DELETE
ON public.tablefortrigger
REFERENCING OLD TABLE AS oldtab
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,13 @@
-- Trigger: trig_after_insert_events_with_transition_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"
AFTER INSERT
ON public.tablefortrigger
REFERENCING NEW TABLE AS inserted
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,9 @@
CREATE OR REPLACE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"
AFTER INSERT
ON public.tablefortrigger
REFERENCING NEW TABLE AS inserted
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,12 @@
-- Trigger: trig_b4r_update_mul_events_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#"
BEFORE INSERT OR UPDATE OF col3
ON public.tablefortrigger
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'multiple event trigger';

View File

@ -0,0 +1,8 @@
CREATE OR REPLACE TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#"
BEFORE INSERT OR UPDATE OF col3
ON public.tablefortrigger
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'multiple event trigger';

View File

@ -0,0 +1,12 @@
-- Trigger: trig_test_statement_$%{}[]()&*^!@\"'`\\/#"
-- DROP TRIGGER IF EXISTS "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#"""
BEFORE INSERT OR DELETE OR TRUNCATE OR UPDATE OF col1, col2, col3
ON public.tablefortrigger
FOR EACH STATEMENT
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,8 @@
CREATE OR REPLACE TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#"""
BEFORE INSERT OR DELETE OR TRUNCATE OR UPDATE OF col1, col2, col3
ON public.tablefortrigger
FOR EACH STATEMENT
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,12 @@
-- Trigger: trig_test_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"
BEFORE INSERT
ON public.tablefortrigger
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,8 @@
CREATE OR REPLACE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"
BEFORE INSERT
ON public.tablefortrigger
FOR EACH ROW
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,13 @@
-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/#
-- DROP TRIGGER IF EXISTS "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger;
CREATE OR REPLACE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"
BEFORE UPDATE OF col1
ON public.tablefortrigger
FOR EACH ROW
WHEN (old.col2 IS DISTINCT FROM new.col2)
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,9 @@
CREATE OR REPLACE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"
BEFORE UPDATE OF col1
ON public.tablefortrigger
FOR EACH ROW
WHEN (OLD.col2 IS DISTINCT FROM NEW.col2)
EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger
IS 'test comment';

View File

@ -0,0 +1,312 @@
{
"scenarios": [
{
"type": "create",
"name": "Create Table",
"endpoint": "NODE-table.obj",
"sql_endpoint": "NODE-table.sql_id",
"data": {
"name": "tablefortrigger",
"columns": [
{
"name": "col1",
"cltype": "integer",
"is_primary_key": true
},
{
"name": "col2",
"cltype": "text"
},
{
"name": "col3",
"cltype": "integer"
}
],
"is_partitioned": false,
"schema": "public",
"spcname": "pg_default"
},
"store_object_id": true
},
{
"type": "create",
"name": "Create trigger function",
"endpoint": "NODE-trigger_function.obj",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"name": "Trig1_$%{}[]()&*^!@\"'`\\/#",
"acl": [],
"args": [],
"funcowner": "enterprisedb",
"lanname": "plpgsql",
"options": [],
"pronamespace": 2200,
"prorettypename": "trigger",
"prosrc": "begin\nselect 1;\nend;",
"seclabels": [],
"variables": [],
"schema": "public"
},
"expected_sql_file": "create_plain_trigger_function.sql"
},
{
"type": "create",
"name": "Create before event trigger -- 14 Plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_test_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "BEFORE",
"evnt_truncate": false,
"description": "test comment",
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"evnt_insert": true
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_before_insert_event_trigger.sql",
"expected_msql_file": "create_before_insert_event_trigger_msql.sql"
},
{
"type": "alter",
"name": "Alter(disable) before event trigger -- 14 Plus",
"endpoint": "NODE-trigger.obj_id",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql_id",
"data": {
"name": "trig_test_$%{}[]()&*^!@\"'`\\/#",
"is_enable_trigger": "D"
},
"schema": "public",
"expected_sql_file": "alter_before_insert_event_trigger.sql",
"expected_msql_file": "alter_before_insert_event_trigger_msql.sql"
},
{
"type": "create",
"name": "Create before update event trigger -- 14 Plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "BEFORE",
"evnt_truncate": false,
"description": "test comment",
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"evnt_update": true,
"columns": "[\"col1\"]",
"whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2"
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_before_update_event_trigger.sql",
"expected_msql_file": "create_before_update_event_trigger_msql.sql"
},
{
"type": "alter",
"name": "Alter before update event trigger enable replica -- 14 Plus",
"endpoint": "NODE-trigger.obj_id",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql_id",
"data": {
"name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#",
"is_enable_trigger": "R"
},
"schema": "public",
"expected_sql_file": "alter_before_update_event_trigger_enable_replica.sql",
"expected_msql_file": "alter_before_update_event_trigger_enable_replica_msql.sql"
},
{
"type": "create",
"name": "Create after update event trigger",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "AFTER",
"evnt_truncate": false,
"description": "comment for update event trigger",
"is_constraint_trigger": true,
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"evnt_update": true,
"whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2",
"columns": "[\"col2\"]"
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_after_update_event_trigger.sql",
"expected_msql_file": "create_after_update_event_trigger_msql.sql"
},
{
"type": "alter",
"name": "Alter after update event trigger enable always",
"endpoint": "NODE-trigger.obj_id",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql_id",
"data": {
"name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#",
"is_enable_trigger": "A"
},
"schema": "public",
"expected_sql_file": "alter_after_update_event_trigger_enable_always.sql",
"expected_msql_file": "alter_after_update_event_trigger_enable_always_msql.sql"
},
{
"type": "create",
"name": "Create trigger on before for multiple events -- 14 Plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_b4r_update_mul_events_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "BEFORE",
"evnt_truncate": false,
"description": "multiple event trigger",
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"evnt_insert": true,
"evnt_update": true,
"columns": "[\"col3\"]",
"whenclause": ""
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_b4r_update_multiple_event_trigger.sql",
"expected_msql_file": "create_b4r_update_multiple_event_trigger_msql.sql"
},
{
"type": "create",
"name": "Create trigger on after delete event with arguments",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "AFTER",
"evnt_truncate": false,
"description": "delete event trig",
"is_constraint_trigger": true,
"tgdeferrable": true,
"tginitdeferred": true,
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"tgargs": "12",
"evnt_delete": true
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_after_delete_event_trigger.sql",
"expected_msql_file": "create_after_delete_event_trigger_msql.sql"
},
{
"type": "delete",
"name": "Delete trigger on after delete event with arguments",
"endpoint": "NODE-trigger.obj_id",
"sql_endpoint": "NODE-trigger.sql_id",
"data": {
"name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#"
},
"schema": "public"
},
{
"type": "create",
"name": "Create before event trigger at statement level -- 14 Plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_test_statement_$%{}[]()&*^!@\\\"'`\\\\/#\"",
"is_row_trigger": false,
"fires": "BEFORE",
"evnt_truncate": true,
"description": "test comment",
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"evnt_insert": true,
"evnt_delete": true,
"evnt_update": true,
"whenclause": "",
"columns": "[\"col1\",\"col2\",\"col3\"]"
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_before_insert_event_at_statement.sql",
"expected_msql_file": "create_before_insert_event_at_statement_msql.sql"
},
{
"type": "create",
"name": "Create trigger on after insert event with transition -- 14 Plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_after_insert_events_with_transition_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "AFTER",
"evnt_truncate": false,
"description": "test comment",
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"evnt_insert": true,
"tgnewtable": "inserted"
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_after_insert_event_trigger_with_transition.sql",
"expected_msql_file": "create_after_insert_event_trigger_with_transition_msql.sql"
},
{
"type": "alter",
"name": "Alter(disable) trigger on after inset event with transition -- 14 Plus",
"endpoint": "NODE-trigger.obj_id",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql_id",
"data": {
"name": "trig_after_insert_events_with_transition_$%{}[]()&*^!@\"'`\\/#",
"is_enable_trigger": "D"
},
"schema": "public",
"expected_sql_file": "alter_after_insert_event_trigger_with_transition.sql",
"expected_msql_file": "alter_after_insert_event_trigger_with_transition_msql.sql"
},
{
"type": "create",
"name": "Create trigger on after delete event with transition -- 14 Plus",
"endpoint": "NODE-trigger.obj",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql",
"data": {
"name": "trig_after_delete_events_with_transition_$%{}[]()&*^!@\"'`\\/#",
"is_row_trigger": true,
"fires": "AFTER",
"evnt_truncate": false,
"description": "test comment",
"tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"",
"is_constraint_trigger": false,
"evnt_delete": true,
"tgoldtable": "oldtab"
},
"schema": "public",
"store_object_id": true,
"expected_sql_file": "create_after_delete_event_trigger_with_transition.sql",
"expected_msql_file": "create_after_delete_event_trigger_with_transition_msql.sql"
},
{
"type": "alter",
"name": "Alter trigger on after delete event with transition always enable -- 14 Plus",
"endpoint": "NODE-trigger.obj_id",
"sql_endpoint": "NODE-trigger.sql_id",
"msql_endpoint": "NODE-trigger.msql_id",
"data": {
"name": "trig_after_delete_events_with_transition_$%{}[]()&*^!@\"'`\\/#",
"is_enable_trigger": "A"
},
"schema": "public",
"expected_sql_file": "alter_after_delete_event_trigger_with_transition.sql",
"expected_msql_file": "alter_after_delete_event_trigger_with_transition_msql.sql"
}
]
}