Add Reverse Engineered SQL tests for Trigger Functions. Fixes #4554

Fix the reverse engineered SQL for trigger functions with the WINDOW option selected. Fixes #4565
This commit is contained in:
Aditya Toshniwal 2019-08-06 14:26:11 +01:00 committed by Dave Page
parent 6800b1f723
commit 9cdb3b40ab
33 changed files with 657 additions and 40 deletions

View File

@ -19,6 +19,7 @@ New features
Housekeeping
************
| `Issue #4554 <https://redmine.postgresql.org/issues/4554>`_ - Add Reverse Engineered SQL tests for Trigger Functions.
| `Issue #4555 <https://redmine.postgresql.org/issues/4555>`_ - Add Reverse Engineered SQL tests for Exclusion Constraint.
| `Issue #4560 <https://redmine.postgresql.org/issues/4560>`_ - Add a --modules option to the RE-SQL test suite to allow testing of specific object types.
@ -38,4 +39,5 @@ Bug fixes
| `Issue #4525 <https://redmine.postgresql.org/issues/4525>`_ - Ensure command tags are shown in the messages tab of the Query Tool.
| `Issue #4536 <https://redmine.postgresql.org/issues/4536>`_ - Fix load on demand in View/Edit data mode.
| `Issue #4552 <https://redmine.postgresql.org/issues/4552>`_ - Fix some errors thrown on the JS console when dragging text in the Query Tool.
| `Issue #4559 <https://redmine.postgresql.org/issues/4559>`_ - Ensure triggers should be updated properly for EPAS server.
| `Issue #4559 <https://redmine.postgresql.org/issues/4559>`_ - Ensure triggers should be updated properly for EPAS server.
| `Issue #4565 <https://redmine.postgresql.org/issues/4565>`_ - Fix the reverse engineered SQL for trigger functions with the WINDOW option selected.

View File

@ -4,16 +4,16 @@
{% set is_columns = [] %}
{% if data %}
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.proargnames %}{{data.proargnames}}{% endif %})
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }} {% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }}{% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
LANGUAGE {{ data.lanname|qtLiteral }}
{% if data.procost %}
COST {{data.procost}}
{% endif %}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %} {% endif %}{% if data.proleakproof %}LEAKPROOF {% else %}NOT LEAKPROOF {% endif %}
{% if data.proisstrict %}STRICT {% endif %}
{% if data.prosecdef %}SECURITY DEFINER {% endif %}
{% if data.proiswindow %}WINDOW{% endif %}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %}{% endif %}{% if data.proleakproof %} LEAKPROOF{% else %} NOT LEAKPROOF{% endif %}
{% if data.proisstrict %} STRICT{% endif %}
{% if data.prosecdef %} SECURITY DEFINER{% endif %}
{% if data.proiswindow %} WINDOW{% endif %}
{% if data.prorows and (data.prorows | int) > 0 %}
ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in data.variables %}

View File

@ -1,5 +1,7 @@
SELECT
pr.oid, pr.xmin, pr.*, pr.prosrc AS prosrc_c,
pr.oid, pr.xmin,
CASE WHEN pr.prokind = 'w' THEN true ELSE false END AS proiswindow,
pr.*, pr.prosrc AS prosrc_c,
pr.proname AS name, pg_get_function_result(pr.oid) AS prorettypename,
typns.nspname AS typnsp, lanname, proargnames, oidvectortypes(proargtypes) AS proargtypenames,
pg_get_expr(proargdefaults, 'pg_catalog.pg_class'::regclass) AS proargdefaultvals,

View File

@ -17,7 +17,7 @@ CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}()
{% if 'lanname' in data %}
LANGUAGE {{ data.lanname|qtLiteral }} {% else %}
LANGUAGE {{ o_data.lanname|qtLiteral }}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }} {% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }}{% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% if ('proleakproof' in data and data.proleakproof) or ('proleakproof' not in data and o_data.proleakproof) %} LEAKPROOF{% elif 'proleakproof' in data and not data.proleakproof %} NOT LEAKPROOF{% endif %}
{% if ('proisstrict' in data and data.proisstrict) or ('proisstrict' not in data and o_data.proisstrict) %} STRICT{% endif %}
{% if ('prosecdef' in data and data.prosecdef) or ('prosecdef' not in data and o_data.prosecdef) %} SECURITY DEFINER{% endif %}

View File

@ -4,16 +4,15 @@
{% set is_columns = [] %}
{% if data %}
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}()
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }} {% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }}{% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
LANGUAGE {{ data.lanname|qtLiteral }}
{% if data.procost %}
COST {{data.procost}}
{% endif %}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %} {% endif %}{% if data.proleakproof %}LEAKPROOF {% else %}NOT LEAKPROOF {% endif %}
{% if data.proisstrict %}STRICT {% endif %}
{% if data.prosecdef %}SECURITY DEFINER {% endif %}
{% if data.proiswindow %}WINDOW{% endif %}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %}{% endif %}{% if data.proleakproof %} LEAKPROOF{% else %} NOT LEAKPROOF{% endif %}{% if data.proisstrict %} STRICT{% endif %}
{% if data.prosecdef %} SECURITY DEFINER{% endif %}
{% if data.proiswindow %} WINDOW{% endif %}
{% if data.prorows and (data.prorows | int) > 0 %}
ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in data.variables %}

View File

@ -16,8 +16,8 @@ CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}()
{% if 'lanname' in data %}
LANGUAGE {{ data.lanname|qtLiteral }} {% else %}
LANGUAGE {{ o_data.lanname|qtLiteral }}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }} {% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% if ('proleakproof' in data and data.proleakproof) or ('proleakproof' not in data and o_data.proleakproof) %} LEAKPROOF{% elif 'proleakproof' in data and not data.proleakproof %}NOT LEAKPROOF{% endif %}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }}{% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% if ('proleakproof' in data and data.proleakproof) or ('proleakproof' not in data and o_data.proleakproof) %} LEAKPROOF{% elif 'proleakproof' in data and not data.proleakproof %} NOT LEAKPROOF{% endif %}
{% if ('proisstrict' in data and data.proisstrict) or ('proisstrict' not in data and o_data.proisstrict) %} STRICT{% endif %}
{% if ('prosecdef' in data and data.prosecdef) or ('prosecdef' not in data and o_data.prosecdef) %} SECURITY DEFINER{% endif %}
{% if ('proiswindow' in data and data.proiswindow) or ('proiswindow' not in data and o_data.proiswindow) %} WINDOW{% endif %}

View File

@ -4,16 +4,16 @@
{% set is_columns = [] %}
{% if data %}
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.proargnames %}{{data.proargnames}}{% endif %})
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }} {% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }}{% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
LANGUAGE {{ data.lanname|qtLiteral }}
{% if data.procost %}
COST {{data.procost}}
{% endif %}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %} {% endif %}{% if data.proleakproof %}LEAKPROOF {% else %}NOT LEAKPROOF {% endif %}
{% if data.proisstrict %}STRICT {% endif %}
{% if data.prosecdef %}SECURITY DEFINER {% endif %}
{% if data.proiswindow %}WINDOW{% endif %}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %}{% endif %}{% if data.proleakproof %} LEAKPROOF{% else %} NOT LEAKPROOF{% endif %}
{% if data.proisstrict %} STRICT{% endif %}
{% if data.prosecdef %} SECURITY DEFINER{% endif %}
{% if data.proiswindow %} WINDOW{% endif %}
{% if data.prorows and (data.prorows | int) > 0 %}
ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in data.variables %}

View File

@ -17,7 +17,7 @@ CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}()
{% if 'lanname' in data %}
LANGUAGE {{ data.lanname|qtLiteral }} {% else %}
LANGUAGE {{ o_data.lanname|qtLiteral }}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }} {% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }}{% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% if ('proleakproof' in data and data.proleakproof) or ('proleakproof' not in data and o_data.proleakproof) %} LEAKPROOF{% elif 'proleakproof' in data and not data.proleakproof %} NOT LEAKPROOF{% endif %}
{% if ('proisstrict' in data and data.proisstrict) or ('proisstrict' not in data and o_data.proisstrict) %} STRICT{% endif %}
{% if ('prosecdef' in data and data.prosecdef) or ('prosecdef' not in data and o_data.prosecdef) %} SECURITY DEFINER{% endif %}

View File

@ -4,13 +4,13 @@
{% set is_columns = [] %}
{% if data %}
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}()
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }} {% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }}{% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
LANGUAGE {{ data.lanname|qtLiteral }}
{% if data.procost %}
COST {{data.procost}}
{% endif %}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %} {% endif %}{% if data.proisstrict %}STRICT {% endif %}{% if data.prosecdef %}SECURITY DEFINER {% endif %}{% if data.proiswindow %}WINDOW{% endif -%}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %}{% endif %}{% if data.proisstrict %} STRICT{% endif %}{% if data.prosecdef %} SECURITY DEFINER{% endif %}{% if data.proiswindow %} WINDOW{% endif -%}
{% if data.prorows and (data.prorows | int) > 0 %}
ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in data.variables %}

View File

@ -16,7 +16,7 @@ CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}()
{% if 'lanname' in data %}
LANGUAGE {{ data.lanname|qtLiteral }} {% else %}
LANGUAGE {{ o_data.lanname|qtLiteral }}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }} {% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }}{% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% if ('proisstrict' in data and data.proisstrict) or ('proisstrict' not in data and o_data.proisstrict) %} STRICT{% endif %}
{% if ('prosecdef' in data and data.prosecdef) or ('prosecdef' not in data and o_data.prosecdef) %} SECURITY DEFINER{% endif %}
{% if ('proiswindow' in data and data.proiswindow) or ('proiswindow' not in data and o_data.proiswindow) %} WINDOW{% endif %}

View File

@ -1,5 +1,7 @@
SELECT
pr.oid, pr.xmin, pr.*, pr.prosrc AS prosrc_c,
pr.oid, pr.xmin,
CASE WHEN pr.prokind = 'w' THEN true ELSE false END AS proiswindow,
pr.*, pr.prosrc AS prosrc_c,
pr.proname AS name, pg_get_function_result(pr.oid) AS prorettypename,
typns.nspname AS typnsp, lanname, proargnames, oidvectortypes(proargtypes) AS proargtypenames,
pg_get_expr(proargdefaults, 'pg_catalog.pg_class'::regclass) AS proargdefaultvals,

View File

@ -4,16 +4,16 @@
{% set is_columns = [] %}
{% if data %}
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}()
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }} {% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }}{% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
LANGUAGE {{ data.lanname|qtLiteral }}
{% if data.procost %}
COST {{data.procost}}
{% endif %}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %} {% endif %}{% if data.proleakproof %} LEAKPROOF {% else %} NOT LEAKPROOF {% endif %}
{% if data.proisstrict %}STRICT {% endif %}
{% if data.prosecdef %}SECURITY DEFINER {% endif %}
{% if data.proiswindow %}WINDOW{% endif %}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %}{% endif %}{% if data.proleakproof %} LEAKPROOF{% else %} NOT LEAKPROOF{% endif %}
{% if data.proisstrict %} STRICT{% endif %}
{% if data.prosecdef %} SECURITY DEFINER{% endif %}
{% if data.proiswindow %} WINDOW{% endif %}
{% if data.prorows and (data.prorows | int) > 0 %}
ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in data.variables %}

View File

@ -16,7 +16,7 @@ CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}()
{% if 'lanname' in data %}
LANGUAGE {{ data.lanname|qtLiteral }} {% else %}
LANGUAGE {{ o_data.lanname|qtLiteral }}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }} {% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }}{% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% if ('proleakproof' in data and data.proleakproof) or ('proleakproof' not in data and o_data.proleakproof) %} LEAKPROOF{% elif 'proleakproof' in data and not data.proleakproof %} NOT LEAKPROOF{% endif %}
{% if ('proisstrict' in data and data.proisstrict) or ('proisstrict' not in data and o_data.proisstrict) %} STRICT{% endif %}
{% if ('prosecdef' in data and data.prosecdef) or ('prosecdef' not in data and o_data.prosecdef) %} SECURITY DEFINER{% endif %}

View File

@ -4,16 +4,16 @@
{% set is_columns = [] %}
{% if data %}
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}()
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }} {% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }}{% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
LANGUAGE {{ data.lanname|qtLiteral }}
{% if data.procost %}
COST {{data.procost}}
{% endif %}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %} {% endif %}{% if data.proleakproof %}LEAKPROOF {% else %}NOT LEAKPROOF {% endif %}
{% if data.proisstrict %}STRICT {% endif %}
{% if data.prosecdef %}SECURITY DEFINER {% endif %}
{% if data.proiswindow %}WINDOW{% endif %}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %}{% endif %}{% if data.proleakproof %} LEAKPROOF{% else %} NOT LEAKPROOF{% endif %}
{% if data.proisstrict %} STRICT{% endif %}
{% if data.prosecdef %} SECURITY DEFINER{% endif %}
{% if data.proiswindow %} WINDOW{% endif %}
{% if data.prorows and (data.prorows | int) > 0 %}
ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in data.variables %}

View File

@ -17,7 +17,7 @@ CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}()
{% if 'lanname' in data %}
LANGUAGE {{ data.lanname|qtLiteral }} {% else %}
LANGUAGE {{ o_data.lanname|qtLiteral }}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }} {% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }}{% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% if ('proleakproof' in data and data.proleakproof) or ('proleakproof' not in data and o_data.proleakproof) %} LEAKPROOF{% elif 'proleakproof' in data and not data.proleakproof %} NOT LEAKPROOF{% endif %}
{% if ('proisstrict' in data and data.proisstrict) or ('proisstrict' not in data and o_data.proisstrict) %} STRICT{% endif %}
{% if ('prosecdef' in data and data.prosecdef) or ('prosecdef' not in data and o_data.prosecdef) %} SECURITY DEFINER{% endif %}

View File

@ -4,13 +4,13 @@
{% set is_columns = [] %}
{% if data %}
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}()
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }} {% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }}{% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
LANGUAGE {{ data.lanname|qtLiteral }}
{% if data.procost %}
COST {{data.procost}}
{% endif %}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %} {% endif %}{% if data.proisstrict %}STRICT {% endif %}{% if data.prosecdef %}SECURITY DEFINER {% endif %}{% if data.proiswindow %}WINDOW{% endif -%}
{% if data.provolatile %}{% if data.provolatile == 'i' %}IMMUTABLE{% elif data.provolatile == 's' %}STABLE{% else %}VOLATILE{% endif %}{% endif %}{% if data.proisstrict %} STRICT{% endif %}{% if data.prosecdef %} SECURITY DEFINER{% endif %}{% if data.proiswindow %} WINDOW{% endif -%}
{% if data.prorows and (data.prorows | int) > 0 %}
ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in data.variables %}

View File

@ -16,7 +16,7 @@ CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}()
{% if 'lanname' in data %}
LANGUAGE {{ data.lanname|qtLiteral }} {% else %}
LANGUAGE {{ o_data.lanname|qtLiteral }}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }} {% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }}{% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %}
{% if ('proisstrict' in data and data.proisstrict) or ('proisstrict' not in data and o_data.proisstrict) %} STRICT{% endif %}
{% if ('prosecdef' in data and data.prosecdef) or ('prosecdef' not in data and o_data.prosecdef) %} SECURITY DEFINER{% endif %}
{% if ('proiswindow' in data and data.proiswindow) or ('proiswindow' not in data and o_data.proiswindow) %} WINDOW{% endif %}

View File

@ -0,0 +1,18 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS trigger
LANGUAGE 'plpgsql'
COST 100
VOLATILE NOT LEAKPROOF
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO postgres;
COMMENT ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
IS 'some comment';

View File

@ -0,0 +1,18 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS trigger
LANGUAGE 'plpgsql'
COST 100
STABLE LEAKPROOF STRICT SECURITY DEFINER
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO postgres;
COMMENT ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
IS 'some comment';

View File

@ -0,0 +1,19 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS trigger
LANGUAGE 'plpgsql'
COST 123
IMMUTABLE LEAKPROOF STRICT SECURITY DEFINER
SET application_name='appname'
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO postgres;
COMMENT ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
IS 'some comment';

View File

@ -0,0 +1,20 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS trigger
LANGUAGE 'plpgsql'
COST 123
IMMUTABLE LEAKPROOF STRICT SECURITY DEFINER
SET application_name='appname2'
SET array_nulls='true'
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO postgres;
COMMENT ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
IS 'some comment';

View File

@ -0,0 +1,24 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS SETOF event_trigger
LANGUAGE 'plpgsql'
COST 1234
VOLATILE LEAKPROOF STRICT SECURITY DEFINER WINDOW
ROWS 4321
SET application_name='appname'
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO postgres;
GRANT EXECUTE ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"() TO postgres WITH GRANT OPTION;
REVOKE ALL ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"() FROM PUBLIC;
COMMENT ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
IS 'some comment';

View File

@ -0,0 +1,15 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS trigger
LANGUAGE 'plpgsql'
COST 100
VOLATILE NOT LEAKPROOF
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO postgres;

View File

@ -0,0 +1,24 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS SETOF trigger
LANGUAGE 'plpgsql'
COST 1234
VOLATILE LEAKPROOF STRICT SECURITY DEFINER WINDOW
ROWS 4321
SET application_name='appname'
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO postgres;
GRANT EXECUTE ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"() TO postgres WITH GRANT OPTION;
REVOKE ALL ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"() FROM PUBLIC;
COMMENT ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
IS 'some comment';

View File

@ -0,0 +1,182 @@
{
"scenarios": [
{
"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.sql"
}, {
"type": "alter",
"name": "Alter trigger function comment",
"endpoint": "NODE-trigger_function.obj_id",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"description": "some comment"
},
"expected_sql_file": "alter_ptrig_comment.sql"
}, {
"type": "alter",
"name": "Alter trigger function Set 1",
"endpoint": "NODE-trigger_function.obj_id",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"proisstrict": true,
"proleakproof": true,
"prosecdef": true,
"provolatile": "s"
},
"expected_sql_file": "alter_ptrig_set_1.sql"
}, {
"type": "alter",
"name": "Alter trigger function Set 2",
"endpoint": "NODE-trigger_function.obj_id",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"procost": "123",
"provolatile": "i",
"variables": {
"added": [{
"name": "application_name",
"value": "appname"
}]
}
},
"expected_sql_file": "alter_ptrig_set_2.sql"
}, {
"type": "alter",
"name": "Alter trigger function Set 3",
"endpoint": "NODE-trigger_function.obj_id",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"variables": {
"added": [{
"name": "application_name",
"value": "appname2"
}],
"changed": [{
"name": "array_nulls",
"value": true
}]
}
},
"expected_sql_file": "alter_ptrig_set_3.sql"
}, {
"type": "delete",
"name": "Drop trigger function",
"endpoint": "NODE-trigger_function.delete_id",
"data": {
}
}, {
"type": "create",
"name": "Create full fledged trigger function",
"endpoint": "NODE-trigger_function.obj",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"name": "Trig1_$%{}[]()&*^!@\"'`\\/#",
"acl": [{
"grantee": "postgres",
"grantor": "postgres",
"privileges": [
{
"privilege": true,
"privilege_type": "X",
"with_grant": true
}
]
}],
"args": [],
"description": "some comment",
"funcowner": "postgres",
"lanname": "plpgsql",
"options": [],
"procost": "1234",
"proisstrict": true,
"proiswindow": true,
"proleakproof": true,
"pronamespace": 2200,
"proretset": true,
"prorettypename": "trigger",
"prorows": "4321",
"prosecdef": true,
"provolatile": "s",
"prosrc": "begin\nselect 1;\nend;",
"seclabels": [],
"variables": [{
"name": "application_name",
"value": "appname"
}],
"schema": "public"
},
"expected_sql_file": "create_plain_trigger_full.sql"
}, {
"type": "delete",
"name": "Drop full fledged trigger function",
"endpoint": "NODE-trigger_function.delete_id",
"data": {
}
}, {
"type": "create",
"name": "Create full fledged event trigger function",
"endpoint": "NODE-trigger_function.obj",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"name": "Trig1_$%{}[]()&*^!@\"'`\\/#",
"acl": [{
"grantee": "postgres",
"grantor": "postgres",
"privileges": [
{
"privilege": true,
"privilege_type": "X",
"with_grant": true
}
]
}],
"args": [],
"description": "some comment",
"funcowner": "postgres",
"lanname": "plpgsql",
"options": [],
"procost": "1234",
"proisstrict": true,
"proiswindow": true,
"proleakproof": true,
"pronamespace": 2200,
"proretset": true,
"prorettypename": "event_trigger",
"prorows": "4321",
"prosecdef": true,
"provolatile": "s",
"prosrc": "begin\nselect 1;\nend;",
"seclabels": [],
"variables": [{
"name": "application_name",
"value": "appname"
}],
"schema": "public"
},
"expected_sql_file": "create_event_trigger_full.sql"
}, {
"type": "delete",
"name": "Drop full fledged event trigger function",
"endpoint": "NODE-trigger_function.delete_id",
"data": {
}
}
]
}

View File

@ -0,0 +1,18 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS trigger
LANGUAGE 'plpgsql'
COST 100
VOLATILE NOT LEAKPROOF
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO enterprisedb;
COMMENT ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
IS 'some comment';

View File

@ -0,0 +1,18 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS trigger
LANGUAGE 'plpgsql'
COST 100
STABLE LEAKPROOF STRICT SECURITY DEFINER
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO enterprisedb;
COMMENT ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
IS 'some comment';

View File

@ -0,0 +1,19 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS trigger
LANGUAGE 'plpgsql'
COST 123
IMMUTABLE LEAKPROOF STRICT SECURITY DEFINER
SET application_name='appname'
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO enterprisedb;
COMMENT ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
IS 'some comment';

View File

@ -0,0 +1,20 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS trigger
LANGUAGE 'plpgsql'
COST 123
IMMUTABLE LEAKPROOF STRICT SECURITY DEFINER
SET application_name='appname2'
SET array_nulls='true'
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO enterprisedb;
COMMENT ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
IS 'some comment';

View File

@ -0,0 +1,20 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS SETOF event_trigger
LANGUAGE 'plpgsql'
COST 1234
VOLATILE LEAKPROOF STRICT SECURITY DEFINER WINDOW
ROWS 4321
SET application_name='appname'
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO enterprisedb;
COMMENT ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
IS 'some comment';

View File

@ -0,0 +1,15 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS trigger
LANGUAGE 'plpgsql'
COST 100
VOLATILE NOT LEAKPROOF
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO enterprisedb;

View File

@ -0,0 +1,20 @@
-- FUNCTION: public."Trig1_$%{}[]()&*^!@""'`\/#"()
-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
RETURNS SETOF trigger
LANGUAGE 'plpgsql'
COST 1234
VOLATILE LEAKPROOF STRICT SECURITY DEFINER WINDOW
ROWS 4321
SET application_name='appname'
AS $BODY$begin
select 1;
end;$BODY$;
ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
OWNER TO enterprisedb;
COMMENT ON FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
IS 'some comment';

View File

@ -0,0 +1,162 @@
{
"scenarios": [
{
"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.sql"
}, {
"type": "alter",
"name": "Alter trigger function comment",
"endpoint": "NODE-trigger_function.obj_id",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"description": "some comment"
},
"expected_sql_file": "alter_ptrig_comment.sql"
}, {
"type": "alter",
"name": "Alter trigger function Set 1 - Strict, Leakproof, Security of definer, Volatility",
"endpoint": "NODE-trigger_function.obj_id",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"proisstrict": true,
"proleakproof": true,
"prosecdef": true,
"provolatile": "s"
},
"expected_sql_file": "alter_ptrig_set_1.sql"
}, {
"type": "alter",
"name": "Alter trigger function Set 2 - Cost, Volatility, Add Param",
"endpoint": "NODE-trigger_function.obj_id",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"procost": "123",
"provolatile": "i",
"variables": {
"added": [{
"name": "application_name",
"value": "appname"
}]
}
},
"expected_sql_file": "alter_ptrig_set_2.sql"
}, {
"type": "alter",
"name": "Alter trigger function Set 3 - Add Param, Change Param",
"endpoint": "NODE-trigger_function.obj_id",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"variables": {
"changed": [{
"name": "application_name",
"value": "appname2"
}],
"added": [{
"name": "array_nulls",
"value": true
}]
}
},
"expected_sql_file": "alter_ptrig_set_3.sql"
}, {
"type": "delete",
"name": "Drop trigger function",
"endpoint": "NODE-trigger_function.delete_id",
"data": {
}
}, {
"type": "create",
"name": "Create full fledged trigger function",
"endpoint": "NODE-trigger_function.obj",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"name": "Trig1_$%{}[]()&*^!@\"'`\\/#",
"acl": [],
"args": [],
"description": "some comment",
"funcowner": "enterprisedb",
"lanname": "plpgsql",
"options": [],
"procost": "1234",
"proisstrict": true,
"proiswindow": true,
"proleakproof": true,
"pronamespace": 2200,
"proretset": true,
"prorettypename": "trigger",
"prorows": "4321",
"prosecdef": true,
"provolatile": "s",
"prosrc": "begin\nselect 1;\nend;",
"seclabels": [],
"variables": [{
"name": "application_name",
"value": "appname"
}],
"schema": "public"
},
"expected_sql_file": "create_plain_trigger_full.sql"
}, {
"type": "delete",
"name": "Drop full fledged trigger function",
"endpoint": "NODE-trigger_function.delete_id",
"data": {
}
}, {
"type": "create",
"name": "Create full fledged event trigger function",
"endpoint": "NODE-trigger_function.obj",
"sql_endpoint": "NODE-trigger_function.sql_id",
"data": {
"name": "Trig1_$%{}[]()&*^!@\"'`\\/#",
"acl": [],
"args": [],
"description": "some comment",
"funcowner": "enterprisedb",
"lanname": "plpgsql",
"options": [],
"procost": "1234",
"proisstrict": true,
"proiswindow": true,
"proleakproof": true,
"pronamespace": 2200,
"proretset": true,
"prorettypename": "event_trigger",
"prorows": "4321",
"prosecdef": true,
"provolatile": "s",
"prosrc": "begin\nselect 1;\nend;",
"seclabels": [],
"variables": [{
"name": "application_name",
"value": "appname"
}],
"schema": "public"
},
"expected_sql_file": "create_event_trigger_full.sql"
}, {
"type": "delete",
"name": "Drop full fledged event trigger function",
"endpoint": "NODE-trigger_function.delete_id",
"data": {
}
}
]
}