Fixed following issues for Procedures:

1) Change comments on the procedure with arguments as a procedure can be overloaded.
     Note that on EPAS servers, procedure overloading works only for v11+.
  2) The save button of a procedure dialog is enabled without any change.
  3) Fixed formatting of the reverse-engineered SQL.
  4) On EPAS servers, the parameters set were not displayed in the SQL generated.
     They are visible only if set to edbsql.
  5) Changing the volatility option of any existing procedure was not working.
  6) Changing the parallel option (EPAS v9.6+) was not working.
  7) Added RE-SQL test cases for procedures.

Fixes #4620, Fixes #4873
pull/29/head
Aditya Toshniwal 2020-04-15 13:54:17 +05:30 committed by Akshay Joshi
parent 8654d6cf43
commit 0424f7d962
64 changed files with 1511 additions and 37 deletions

View File

@ -20,6 +20,7 @@ New features
Housekeeping
************
| `Issue #4620 <https://redmine.postgresql.org/issues/4620>`_ - Add Reverse Engineered and Modified SQL tests for procedures.
Bug fixes
*********
@ -35,6 +36,7 @@ Bug fixes
| `Issue #4512 <https://redmine.postgresql.org/issues/4512>`_ - Fixed calendar opening issue on the exception tab inside the schedules tab of pgAgent.
| `Issue #4856 <https://redmine.postgresql.org/issues/4856>`_ - Enable the save button by default when a query tool is opened with CREATE or other scripts.
| `Issue #4864 <https://redmine.postgresql.org/issues/4864>`_ - Make the configuration window in runtime to auto-resize.
| `Issue #4873 <https://redmine.postgresql.org/issues/4873>`_ - Fixed an issue when changing the comments of the procedure with arguments gives error in case of overloading.
| `Issue #4969 <https://redmine.postgresql.org/issues/4969>`_ - Fixed an issue where changing the values of columns with JSONB or JSON types to NULL.
| `Issue #5007 <https://redmine.postgresql.org/issues/5007>`_ - Ensure index dropdown should have existing indexes while creating unique constraints.
| `Issue #5053 <https://redmine.postgresql.org/issues/5053>`_ - Fixed an issue where changing the columns in the existing view throws an error.

View File

@ -1006,14 +1006,14 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
if diff_schema:
res['rows'][0]['nspname'] = diff_schema
# Add newline and tab before each argument to format
name_with_default_args = self.qtIdent(
self.conn,
res['rows'][0]['nspname'],
res['rows'][0]['proname']
) + '(' + res['rows'][0]['func_args'] + ')'
# Add newline and tab before each argument to format
name_with_default_args = name_with_default_args.replace(
', ', ',\r\t').replace('(', '(\r\t')
) + '(\n\t' + res['rows'][0]['func_args'].\
replace(', ', ',\n\t') + ')'
# Parse privilege data
if 'acl' in resp_data:
@ -1061,16 +1061,13 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
res['rows'][0]['nspname'] = diff_schema
resp_data['pronamespace'] = diff_schema
# Add newline and tab before each argument to format
name_with_default_args = self.qtIdent(
self.conn,
res['rows'][0]['nspname'],
res['rows'][0]['proname']
) + '(' + res['rows'][0]['func_args'] + ')'
# Add newline and tab before each argument to format
name_with_default_args = name_with_default_args.replace(
', ',
',\r\t'
).replace('(', '(\r\t')
) + '(\n\t' + res['rows'][0]['func_args']. \
replace(', ', ',\n\t') + ')'
# Generate sql for "SQL panel"
# func_def is function signature with default arguments
@ -1148,8 +1145,9 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
data['pronamespace'] = self._get_schema(
data['pronamespace']
)
if 'provolatile' in data and data['provolatile']:
data['provolatile'] = vol_dict[data['provolatile']]
if 'provolatile' in data:
data['provolatile'] = vol_dict[data['provolatile']]\
if data['provolatile'] else ''
if fnid is not None:
# Edit Mode

View File

@ -124,10 +124,10 @@ define('pgadmin.node.procedure', [
m.get('lanname') != 'edbspl') {
setTimeout(function() {
m.set('provolatile', undefined);
m.set('proisstrict', undefined);
m.set('procost', undefined);
m.set('proleakproof', undefined);
m.set('provolatile', null);
m.set('proisstrict', false);
m.set('procost', null);
m.set('proleakproof', false);
}, 10);
return true;
}
@ -145,7 +145,7 @@ define('pgadmin.node.procedure', [
this.node_info.server.server_type != 'ppas' ||
m.get('lanname') != 'edbspl') {
setTimeout(function() {
m.set('proparallel', undefined);
m.set('proparallel', null);
}, 10);
return true;
}

View File

@ -14,11 +14,12 @@ CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% i
{% endif %}
)
{% endif %}
LANGUAGE {{ data.lanname|qtLiteral }}
{% if data.prosecdef %}SECURITY DEFINER {% endif %}
LANGUAGE {{ data.lanname|qtLiteral }}{% if data.prosecdef %}
SECURITY DEFINER {% endif %}
{% if data.variables %}{% for v in data.variables %}
SET {{ conn|qtIdent(v.name) }}={% if v.name in exclude_quoting %}{{ v.value }}{% else %}{{ v.value|qtLiteral }}{% endif %}{% endfor -%}
SET {{ conn|qtIdent(v.name) }}={% if v.name in exclude_quoting %}{{ v.value }}{% else %}{{ v.value|qtLiteral }}{% endif %}{% endfor -%}
{% endif %}
AS {% if data.lanname == 'c' %}
@ -36,7 +37,7 @@ $BODY${{ data.prosrc }}$BODY${% endif -%};
{% endif %}
{% if data.description %}
COMMENT ON PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}
COMMENT ON PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func_args_without}})
IS {{ data.description|qtLiteral }};
{% endif -%}
{% if data.seclabels %}

View File

@ -96,7 +96,7 @@ ALTER PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if o_data.proarg
{% endif -%}
{% if data.description is defined and data.description != o_data.description%}
COMMENT ON PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}
COMMENT ON PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}({{o_data.proargtypenames }})
IS {{ data.description|qtLiteral }};
{% endif -%}
{% if data.pronamespace %}

View File

@ -14,8 +14,9 @@ CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% i
{% endif %}
)
{% endif %}
LANGUAGE {{ data.lanname|qtLiteral }}
{% if data.prosecdef %}SECURITY DEFINER {% endif %}
LANGUAGE {{ data.lanname|qtLiteral }}{% if data.prosecdef %}
SECURITY DEFINER {% endif %}
{% if data.lanname == 'edbspl' %}
{{ data.provolatile }} {% if data.proleakproof %}LEAKPROOF {% endif %}
{% if data.proisstrict %}STRICT {% endif %}
@ -24,11 +25,10 @@ LANGUAGE {{ data.lanname|qtLiteral }}
COST {{data.procost}}{% endif %}{% if data.prorows and (data.prorows | int) > 0 %}
ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in data.variables %}
ROWS {{data.prorows}}{% endif -%}{% endif %}{% if data.variables %}{% for v in data.variables %}
SET {{ conn|qtIdent(v.name) }}={% if v.name in exclude_quoting %}{{ v.value }}{% else %}{{ v.value|qtLiteral }}{% endif %}{% endfor -%}
{% endif %}
{% endif %}
AS {% if data.lanname == 'c' %}
{{ data.probin|qtLiteral }}, {{ data.prosrc_c|qtLiteral }}
@ -45,7 +45,7 @@ $BODY${{ data.prosrc }}$BODY${% endif -%};
{% endif %}
{% if data.description %}
COMMENT ON PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}
COMMENT ON PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func_args_without}})
IS {{ data.description|qtLiteral }};
{% endif -%}
{% if data.seclabels %}

View File

@ -104,7 +104,7 @@ ALTER PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if o_data.proarg
{% endif -%}
{% if data.description is defined and data.description != o_data.description%}
COMMENT ON PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}
COMMENT ON PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}({{o_data.proargtypenames }})
IS {{ data.description|qtLiteral }};
{% endif -%}
{% if data.pronamespace %}

View File

@ -16,7 +16,7 @@ CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% i
{% endif %}
{{ data.provolatile }} {% if data.proleakproof %}LEAKPROOF {% endif %}
{% if data.proisstrict %}STRICT {% endif %}
{% if data.prosecdef %}SECURITY DEFINER {% endif %}{% if data.procost %}
{% if data.prosecdef %}SECURITY DEFINER{% endif %}{% if data.procost %}
COST {{data.procost}}{% endif %}{% if data.prorows and (data.prorows | int) > 0 %}

View File

@ -16,7 +16,7 @@ CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if d
{% endfor %}
)
{% endif %}
{% if ('proleakproof' in data and data.proleakproof) or ('proleakproof' not in data and o_data.proleakproof) %}LEAKPROOF{% else %}NOT LEAKPROOF{% endif %}
{{ data.provolatile }} {% if ('proleakproof' in data and data.proleakproof) or ('proleakproof' not in data and o_data.proleakproof) %}LEAKPROOF{% else %}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 %}
@ -27,8 +27,7 @@ CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if d
SET {{ conn|qtIdent(v.name) }}={% if v.name in exclude_quoting %}{{ v.value }}{% else %}{{ v.value|qtLiteral }}{% endif %}{% endfor -%}
{% endif %}
AS
{% if data.prosrc %}{{ data.prosrc }}{% else %}{{ o_data.prosrc }}{% endif -%};
AS {% if data.prosrc %}{{ data.prosrc }}{% else %}{{ o_data.prosrc }}{% endif -%};
{% endif -%}
{% if data.funcowner %}

View File

@ -16,9 +16,9 @@ CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% i
{% endif %}
{{ data.provolatile }} {% if data.proleakproof %}LEAKPROOF {% endif %}
{% if data.proisstrict %}STRICT {% endif %}
{% if data.prosecdef %}SECURITY DEFINER {% endif %}
{% if data.prosecdef %}SECURITY DEFINER{% endif %}
{% if data.proparallel and (data.proparallel == 'r' or data.proparallel == 's') %}
{% if data.proparallel == 'r' %}PARALLEL RESTRICTED{% elif data.proparallel == 's' %}PARALLEL SAFE{% endif %}{% endif %}{% if data.procost %}
{% if data.proparallel == 'r' %} PARALLEL RESTRICTED{% elif data.proparallel == 's' %} PARALLEL SAFE{% endif %}{% endif %}{% if data.procost %}
COST {{data.procost}}{% endif %}{% if data.prorows and (data.prorows | int) > 0 %}

View File

@ -0,0 +1,46 @@
SELECT
pr.oid, pr.xmin,
pr.prosrc, pr.prosrc AS prosrc_c, pr.pronamespace, pr.prolang, pr.procost, pr.prorows,
pr.prosecdef, pr.proleakproof, pr.proisstrict, pr.proretset, pr.provolatile, pr.proparallel,
pr.pronargs, pr.prorettype, pr.proallargtypes, pr.proargmodes, pr.probin, pr.proacl,
pr.proname, 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,
pr.pronargdefaults, proconfig, pg_get_userbyid(proowner) AS funcowner, description,
(
WITH name_with_args_tab AS (SELECT pg_catalog.pg_get_function_identity_arguments(pr.oid) AS val)
SELECT CASE WHEN
val <> ''
THEN
pr.proname || '(' || val || ')'
ELSE
pr.proname::text
END
FROM name_with_args_tab
) AS name_with_args,
(SELECT
array_agg(provider || '=' || label)
FROM
pg_seclabel sl1
WHERE
sl1.objoid=pr.oid) AS seclabels
FROM
pg_proc pr
JOIN
pg_type typ ON typ.oid=prorettype
JOIN
pg_namespace typns ON typns.oid=typ.typnamespace
JOIN
pg_language lng ON lng.oid=prolang
LEFT OUTER JOIN
pg_description des ON (des.objoid=pr.oid AND des.classoid='pg_proc'::regclass and des.objsubid = 0)
WHERE
proisagg = FALSE
AND typname NOT IN ('trigger', 'event_trigger')
{% if fnid %}
AND pr.oid = {{fnid}}::oid
{% else %}
AND pronamespace = {{scid}}::oid
{% endif %}
ORDER BY
proname;

View File

@ -16,7 +16,8 @@ CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if d
{% endfor %}
)
{% endif %}
{% if ('proleakproof' in data and data.proleakproof) or ('proleakproof' not in data and o_data.proleakproof) %}LEAKPROOF{% else %}NOT LEAKPROOF{% endif %}
{{ data.provolatile }} {% if ('proleakproof' in data and data.proleakproof) or ('proleakproof' not in data and o_data.proleakproof) %}LEAKPROOF{% else %}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 %}
@ -29,8 +30,7 @@ CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if d
SET {{ conn|qtIdent(v.name) }}={% if v.name in exclude_quoting %}{{ v.value }}{% else %}{{ v.value|qtLiteral }}{% endif %}{% endfor -%}
{% endif %}
AS
{% if data.prosrc %}{{ data.prosrc }}{% else %}{{ o_data.prosrc }}{% endif -%};
AS {% if data.prosrc %}{{ data.prosrc }}{% else %}{{ o_data.prosrc }}{% endif %};
{% endif -%}
{% if data.funcowner %}

View File

@ -0,0 +1,13 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
LANGUAGE 'plpgsql'
AS $BODY$begin
select 1;
end;$BODY$;
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer)
IS 'some comment';

View File

@ -0,0 +1,2 @@
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer)
IS 'some comment';

View File

@ -0,0 +1,14 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
LANGUAGE 'plpgsql'
SET application_name='pgadmin'
AS $BODY$begin
select 1;
end;$BODY$;
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer)
IS 'some comment';

View File

@ -0,0 +1,2 @@
ALTER PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer)
SET application_name=pgadmin;

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,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='appname'
SET search_path=public, pg_temp
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,21 @@
-- 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 search_path=public, pg_catalog
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,25 @@
-- 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'
SET search_path=public, pg_temp
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,10 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
LANGUAGE 'plpgsql'
AS $BODY$begin
select 1;
end;$BODY$;

View File

@ -0,0 +1,58 @@
{
"scenarios": [
{
"type": "create",
"name": "Create procedure",
"endpoint": "NODE-procedure.obj",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"name": "Proc1_$%{}[]()&*^!@\"'`\\/#",
"acl": [],
"arguments": [{"argtype": "integer", "argmode": "IN", "argname": "i1", "argdefval": ""}],
"funcowner": "postgres",
"lanname": "plpgsql",
"options": [],
"pronamespace": 2200,
"prosrc": "begin\nselect 1;\nend;",
"seclabels": [],
"variables": [],
"schema": "public",
"provolatile": null,
"proisstrict": false,
"proparallel": null,
"procost": null,
"proleakproof": false,
"probin": "$libdir/"
},
"expected_sql_file": "create_procedure.sql"
}, {
"type": "alter",
"name": "Alter procedure comment",
"endpoint": "NODE-procedure.obj_id",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"description": "some comment"
},
"expected_sql_file": "alter_proc_comment.sql",
"expected_msql_file": "alter_proc_comment_msql.sql"
}, {
"type": "alter",
"name": "Alter procedure param",
"endpoint": "NODE-procedure.obj_id",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"variables": {
"added": [{"name": "application_name", "value": "pgadmin"}]
}
},
"expected_sql_file": "alter_proc_param.sql",
"expected_msql_file": "alter_proc_param_msql.sql"
}, {
"type": "delete",
"name": "Drop procedure",
"endpoint": "NODE-procedure.delete_id",
"data": {
}
}
]
}

View File

@ -0,0 +1,191 @@
{
"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 - 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"
},{
"name": "search_path",
"value": "public, pg_temp"
}]
}
},
"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": {
"added": [{
"name": "application_name",
"value": "appname2"
}],
"changed": [{
"name": "array_nulls",
"value": true
},{
"name": "search_path",
"value": "public, pg_catalog"
}]
}
},
"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"
},{
"name": "search_path",
"value": "public, pg_temp"
}],
"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,13 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
LANGUAGE 'plpgsql'
AS $BODY$begin
select 1;
end;$BODY$;
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer)
IS 'some comment';

View File

@ -0,0 +1,2 @@
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer)
IS 'some comment';

View File

@ -0,0 +1,14 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
LANGUAGE 'plpgsql'
SET application_name='pgadmin'
AS $BODY$begin
select 1;
end;$BODY$;
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer)
IS 'some comment';

View File

@ -0,0 +1,2 @@
ALTER PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer)
SET application_name=pgadmin;

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,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='appname'
SET search_path=public, pg_temp
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,21 @@
-- 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 search_path=public, pg_catalog
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,21 @@
-- 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'
SET search_path=public, pg_temp
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,10 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
LANGUAGE 'plpgsql'
AS $BODY$begin
select 1;
end;$BODY$;

View File

@ -0,0 +1,58 @@
{
"scenarios": [
{
"type": "create",
"name": "Create procedure",
"endpoint": "NODE-procedure.obj",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"name": "Proc1_$%{}[]()&*^!@\"'`\\/#",
"acl": [],
"arguments": [{"argtype": "integer", "argmode": "IN", "argname": "i1", "argdefval": ""}],
"funcowner": "postgres",
"lanname": "plpgsql",
"options": [],
"pronamespace": 2200,
"prosrc": "begin\nselect 1;\nend;",
"seclabels": [],
"variables": [],
"schema": "public",
"provolatile": null,
"proisstrict": false,
"proparallel": null,
"procost": null,
"proleakproof": false,
"probin": "$libdir/"
},
"expected_sql_file": "create_procedure.sql"
}, {
"type": "alter",
"name": "Alter procedure comment",
"endpoint": "NODE-procedure.obj_id",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"description": "some comment"
},
"expected_sql_file": "alter_proc_comment.sql",
"expected_msql_file": "alter_proc_comment_msql.sql"
}, {
"type": "alter",
"name": "Alter procedure param",
"endpoint": "NODE-procedure.obj_id",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"variables": {
"added": [{"name": "application_name", "value": "pgadmin"}]
}
},
"expected_sql_file": "alter_proc_param.sql",
"expected_msql_file": "alter_proc_param_msql.sql"
}, {
"type": "delete",
"name": "Drop procedure",
"endpoint": "NODE-procedure.delete_id",
"data": {
}
}
]
}

View File

@ -0,0 +1,171 @@
{
"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"
},{
"name": "search_path",
"value": "public, pg_temp"
}]
}
},
"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"
},{
"name": "search_path",
"value": "public, pg_catalog"
}],
"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"
},{
"name": "search_path",
"value": "public, pg_temp"
}],
"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": {
}
}
]
}

View File

@ -0,0 +1,14 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
VOLATILE SECURITY DEFINER
COST 100
AS begin
select 1;
end;
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"
IS 'some comment';

View File

@ -0,0 +1,2 @@
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`/#"
IS 'some comment';

View File

@ -0,0 +1,15 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
STABLE SECURITY DEFINER PARALLEL RESTRICTED
COST 120
SET application_name='pgadmin'
AS begin
select 1;
end;
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"
IS 'some comment';

View File

@ -0,0 +1,15 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
STABLE SECURITY DEFINER PARALLEL RESTRICTED
COST 120
SET application_name='pgadmin'
AS begin
select 1;
end;
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"
IS 'some comment';

View File

@ -0,0 +1,15 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
VOLATILE SECURITY DEFINER
COST 100
SET application_name='pgadmin'
AS begin
select 1;
end;
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"
IS 'some comment';

View File

@ -0,0 +1,2 @@
ALTER PROCEDURE public."Proc1_$%{}[]()&*^!@""'`/#"
SET application_name=pgadmin;

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,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='appname'
SET search_path=public, pg_temp
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,21 @@
-- 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 search_path=public, pg_catalog
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,21 @@
-- 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'
SET search_path=public, pg_temp
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,11 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
VOLATILE SECURITY DEFINER
COST 100
AS begin
select 1;
end;

View File

@ -0,0 +1,71 @@
{
"scenarios": [
{
"type": "create",
"name": "Create procedure",
"endpoint": "NODE-procedure.obj",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"name": "Proc1_$%{}[]()&*^!@\"'`\\/#",
"acl": [],
"arguments": [{"argtype": "integer", "argmode": "IN", "argname": "i1", "argdefval": ""}],
"funcowner": "enterprisedb",
"lanname": "edbspl",
"options": [],
"pronamespace": 2200,
"prosrc": "begin\nselect 1;\nend;",
"seclabels": [],
"variables": [],
"schema": "public",
"provolatile": null,
"proisstrict": false,
"proparallel": null,
"procost": null,
"proleakproof": false,
"probin": "$libdir/"
},
"expected_sql_file": "create_procedure.sql"
}, {
"type": "alter",
"name": "Alter procedure comment",
"endpoint": "NODE-procedure.obj_id",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"description": "some comment"
},
"expected_sql_file": "alter_proc_comment.sql",
"expected_msql_file": "alter_proc_comment_msql.sql"
}, {
"type": "alter",
"name": "Alter procedure param",
"endpoint": "NODE-procedure.obj_id",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"variables": {
"added": [{"name": "application_name", "value": "pgadmin"}]
}
},
"expected_sql_file": "alter_proc_param.sql",
"expected_msql_file": "alter_proc_param_msql.sql"
}, {
"type": "alter",
"name": "Alter procedure options",
"endpoint": "NODE-procedure.obj_id",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"provolatile": "s",
"proparallel": "r",
"description": "some comment",
"procost": "120"
},
"expected_sql_file": "alter_proc_opt.sql",
"expected_msql_file": "alter_proc_opt_msql.sql"
}, {
"type": "delete",
"name": "Drop procedure",
"endpoint": "NODE-procedure.delete_id",
"data": {
}
}
]
}

View File

@ -0,0 +1,171 @@
{
"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"
},{
"name": "search_path",
"value": "public, pg_temp"
}]
}
},
"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"
},{
"name": "search_path",
"value": "public, pg_catalog"
}],
"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"
},{
"name": "search_path",
"value": "public, pg_temp"
}],
"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": {
}
}
]
}

View File

@ -0,0 +1,14 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
VOLATILE SECURITY DEFINER
COST 100
AS begin
select 1;
end;
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"
IS 'some comment';

View File

@ -0,0 +1,2 @@
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`/#"
IS 'some comment';

View File

@ -0,0 +1,15 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
STABLE SECURITY DEFINER
COST 120
SET application_name='pgadmin'
AS begin
select 1;
end;
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"
IS 'some comment';

View File

@ -0,0 +1,15 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
STABLE SECURITY DEFINER
COST 120
SET application_name='pgadmin'
AS begin
select 1;
end;
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"
IS 'some comment';

View File

@ -0,0 +1,15 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
VOLATILE SECURITY DEFINER
COST 100
SET application_name='pgadmin'
AS begin
select 1;
end;
COMMENT ON PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"
IS 'some comment';

View File

@ -0,0 +1,2 @@
ALTER PROCEDURE public."Proc1_$%{}[]()&*^!@""'`/#"
SET application_name=pgadmin;

View File

@ -0,0 +1,11 @@
-- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
-- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
i1 integer)
VOLATILE SECURITY DEFINER
COST 100
AS begin
select 1;
end;

View File

@ -0,0 +1,71 @@
{
"scenarios": [
{
"type": "create",
"name": "Create procedure",
"endpoint": "NODE-procedure.obj",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"name": "Proc1_$%{}[]()&*^!@\"'`\\/#",
"acl": [],
"arguments": [{"argtype": "integer", "argmode": "IN", "argname": "i1", "argdefval": ""}],
"funcowner": "enterprisedb",
"lanname": "edbspl",
"options": [],
"pronamespace": 2200,
"prosrc": "begin\nselect 1;\nend;",
"seclabels": [],
"variables": [],
"schema": "public",
"provolatile": null,
"proisstrict": false,
"proparallel": null,
"procost": null,
"proleakproof": false,
"probin": "$libdir/"
},
"expected_sql_file": "create_procedure.sql"
}, {
"type": "alter",
"name": "Alter procedure comment",
"endpoint": "NODE-procedure.obj_id",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"description": "some comment"
},
"expected_sql_file": "alter_proc_comment.sql",
"expected_msql_file": "alter_proc_comment_msql.sql"
}, {
"type": "alter",
"name": "Alter procedure param",
"endpoint": "NODE-procedure.obj_id",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"variables": {
"added": [{"name": "application_name", "value": "pgadmin"}]
}
},
"expected_sql_file": "alter_proc_param.sql",
"expected_msql_file": "alter_proc_param_msql.sql"
}, {
"type": "alter",
"name": "Alter procedure options",
"endpoint": "NODE-procedure.obj_id",
"sql_endpoint": "NODE-procedure.sql_id",
"data": {
"provolatile": "s",
"proparallel": "r",
"description": "some comment",
"procost": "120"
},
"expected_sql_file": "alter_proc_opt.sql",
"expected_msql_file": "alter_proc_opt_msql.sql"
}, {
"type": "delete",
"name": "Drop procedure",
"endpoint": "NODE-procedure.delete_id",
"data": {
}
}
]
}