Add Reverse Engineered SQL tests for Packages. Fixes #4456

pull/25/head
Navnath Gadakh 2019-07-11 09:23:13 +01:00 committed by Dave Page
parent cdf655f7db
commit 28585110dd
7 changed files with 146 additions and 0 deletions

View File

@ -21,6 +21,7 @@ Housekeeping
| `Issue #4452 <https://redmine.postgresql.org/issues/4452>`_ - Add Reverse Engineered SQL tests for Languages.
| `Issue #4453 <https://redmine.postgresql.org/issues/4453>`_ - Add Reverse Engineered SQL tests for Extensions.
| `Issue #4454 <https://redmine.postgresql.org/issues/4454>`_ - Add Reverse Engineered SQL tests for FTS Configurations.
| `Issue #4456 <https://redmine.postgresql.org/issues/4456>`_ - Add Reverse Engineered SQL tests for Packages.
Bug fixes
*********

View File

@ -0,0 +1,12 @@
-- Package: public."pkg_emp_$%{}[]()&*^!@""'`\/#"
-- DROP PACKAGE public."pkg_emp_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE PACKAGE public."pkg_emp_$%{}[]()&*^!@""'`\/#"
IS
PROCEDURE get_name(p_empno numeric);
END "pkg_emp_$%{}[]()&*^!@""'`\/#";
COMMENT ON PACKAGE public."pkg_emp_$%{}[]()&*^!@""'`\/#"
IS 'test comment updated';

View File

@ -0,0 +1,17 @@
-- Package: public."pkg_emp_$%{}[]()&*^!@""'`\/#"
-- DROP PACKAGE public."pkg_emp_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE PACKAGE public."pkg_emp_$%{}[]()&*^!@""'`\/#"
IS
FUNCTION func1(v1 integer) RETURN integer;
END "pkg_emp_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE PACKAGE BODY public."pkg_emp_$%{}[]()&*^!@""'`\/#"
IS
FUNCTION func1(v1 integer) RETURN integer IS BEGIN RETURN V1+10;END FUNC1;
END "pkg_emp_$%{}[]()&*^!@""'`\/#";
COMMENT ON PACKAGE public."pkg_emp_$%{}[]()&*^!@""'`\/#"
IS 'test comment';

View File

@ -0,0 +1,43 @@
{
"scenarios": [
{
"type": "create",
"name": "Create Packages",
"endpoint": "NODE-package.obj",
"sql_endpoint": "NODE-package.sql_id",
"data":
{
"name": "pkg_emp_$%{}[]()&*^!@\"'`\\/#",
"description": "test comment",
"owner": "enterprisedb",
"pkgacl": [{
"grantee": "aq_administrator_role",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "X",
"privilege": true,
"with_grant": true
}]
}],
"pkgbodysrc": "FUNCTION func1(v1 integer) RETURN integer IS BEGIN RETURN V1+10;END FUNC1;",
"pkgheadsrc": "FUNCTION func1(v1 integer) RETURN integer;",
"schema": "public"
},
"expected_sql_file": "create_package_with_all_options.sql"
},
{
"type": "alter",
"name": "Alter Packages",
"endpoint": "NODE-package.obj_id",
"sql_endpoint": "NODE-package.sql_id",
"data":
{
"description": "test comment updated",
"owner": "enterprisedb",
"pkgheadsrc": "PROCEDURE get_name(p_empno numeric);",
"schema": "public"
},
"expected_sql_file": "alter_package_headers_and_comment.sql"
}
]
}

View File

@ -0,0 +1,12 @@
-- Package: public."pkg_emp_$%{}[]()&*^!@""'`\/#"
-- DROP PACKAGE public."pkg_emp_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE PACKAGE public."pkg_emp_$%{}[]()&*^!@""'`\/#"
IS
PROCEDURE get_name(p_empno numeric);
END "pkg_emp_$%{}[]()&*^!@""'`\/#";
COMMENT ON PACKAGE public."pkg_emp_$%{}[]()&*^!@""'`\/#"
IS 'test comment updated';

View File

@ -0,0 +1,17 @@
-- Package: public."pkg_emp_$%{}[]()&*^!@""'`\/#"
-- DROP PACKAGE public."pkg_emp_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE PACKAGE public."pkg_emp_$%{}[]()&*^!@""'`\/#"
IS
FUNCTION func1(v1 integer) RETURN integer;
END "pkg_emp_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE PACKAGE BODY public."pkg_emp_$%{}[]()&*^!@""'`\/#"
IS
FUNCTION func1(v1 integer) RETURN integer IS BEGIN RETURN V1+10;END;
END "pkg_emp_$%{}[]()&*^!@""'`\/#";
COMMENT ON PACKAGE public."pkg_emp_$%{}[]()&*^!@""'`\/#"
IS 'test comment';

View File

@ -0,0 +1,44 @@
{
"scenarios": [
{
"type": "create",
"name": "Create Packages",
"endpoint": "NODE-package.obj",
"sql_endpoint": "NODE-package.sql_id",
"data":
{
"name": "pkg_emp_$%{}[]()&*^!@\"'`\\/#",
"description": "test comment",
"owner": "enterprisedb",
"pkgacl": [{
"grantee": "aq_administrator_role",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "X",
"privilege": true,
"with_grant": true
}]
}],
"pkgbodysrc": "FUNCTION func1(v1 integer) RETURN integer IS BEGIN RETURN V1+10;END FUNC1;",
"pkgheadsrc": "FUNCTION func1(v1 integer) RETURN integer;",
"schema": "public"
},
"expected_sql_file": "create_package_with_all_options.sql"
},
{
"type": "alter",
"name": "Alter Packages",
"endpoint": "NODE-package.obj_id",
"sql_endpoint": "NODE-package.sql_id",
"data":
{
"description": "test comment updated",
"owner": "enterprisedb",
"pkgheadsrc": "PROCEDURE get_name(p_empno numeric);",
"pkgbodysrc": "PROCEDURE get_name(p_empno numeric);",
"schema": "public"
},
"expected_sql_file": "alter_package_headers_and_comment.sql"
}
]
}