Add Reverse Engineered SQL tests for Domains. Fixes #4463

This commit is contained in:
Neel Patel 2019-07-12 14:39:49 +01:00 committed by Dave Page
parent 79e6f4c008
commit 88ab6db976
7 changed files with 147 additions and 0 deletions

View File

@ -23,6 +23,7 @@ Housekeeping
| `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.
| `Issue #4460 <https://redmine.postgresql.org/issues/4460>`_ - Add Reverse Engineered SQL tests for FTS Dictionaries.
| `Issue #4463 <https://redmine.postgresql.org/issues/4463>`_ - Add Reverse Engineered SQL tests for Domains.
| `Issue #4464 <https://redmine.postgresql.org/issues/4464>`_ - Add Reverse Engineered SQL tests for Collations.
Bug fixes

View File

@ -0,0 +1,16 @@
-- DOMAIN: public."Dom1_$%{}[]()&*^!@""'`\/#"
-- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#";
CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"
AS bigint
DEFAULT 5
NOT NULL;
ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO <OWNER>;
ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"
ADD CONSTRAINT constraint_1 CHECK (true);
COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"
IS 'test updated domain comment';

View File

@ -0,0 +1,15 @@
-- DOMAIN: public."Dom1_$%{}[]()&*^!@""'`\/#"
-- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#";
CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"
AS bigint
DEFAULT 3;
ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO <OWNER>;
ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"
ADD CONSTRAINT constraint_1 CHECK (true);
COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"
IS 'test updated domain comment';

View File

@ -0,0 +1,15 @@
-- DOMAIN: public."Dom2_$%{}[]()&*^!@""'`\/#"
-- DROP DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#";
CREATE DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#"
AS bigint
DEFAULT 3;
ALTER DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#" OWNER TO <OWNER>;
ALTER DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#"
ADD CONSTRAINT constraint_1 CHECK (true);
COMMENT ON DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#"
IS 'test updated domain comment';

View File

@ -0,0 +1,15 @@
-- DOMAIN: public."Dom1_$%{}[]()&*^!@""'`\/#"
-- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#";
CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"
AS bigint
DEFAULT 5;
ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO <OWNER>;
ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"
ADD CONSTRAINT constraint_1 CHECK (true);
COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"
IS 'test updated domain comment';

View File

@ -0,0 +1,16 @@
-- DOMAIN: public."Dom1_$%{}[]()&*^!@""'`\/#"
-- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#";
CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"
AS bigint
DEFAULT 5
NOT NULL;
ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO <OWNER>;
ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"
ADD CONSTRAINT constraint_1 CHECK (true);
COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"
IS 'test_comment';

View File

@ -0,0 +1,69 @@
{
"scenarios": [{
"type": "create",
"name": "Create Domain",
"endpoint": "NODE-domain.obj",
"sql_endpoint": "NODE-domain.sql_id",
"data": {
"name": "Dom1_$%{}[]()&*^!@\"'`\\/#",
"schema": "public",
"schema_id": "<SCHEMA_ID>",
"basensp": "public",
"description": "test_comment",
"basetype": "bigint",
"typdefault": "5",
"typnotnull": "true",
"constraints": [{
"conname": "constraint_1",
"consrc": "true",
"convalidated": "true"
}],
"seclabels": []
},
"expected_sql_file": "create_domain.sql"
}, {
"type": "alter",
"name": "Alter domain comment",
"endpoint": "NODE-domain.obj_id",
"sql_endpoint": "NODE-domain.sql_id",
"data": {
"description": "test updated domain comment"
},
"expected_sql_file": "alter_domain_comment.sql"
}, {
"type": "alter",
"name": "Alter domain null type",
"endpoint": "NODE-domain.obj_id",
"sql_endpoint": "NODE-domain.sql_id",
"data": {
"typnotnull": "false"
},
"expected_sql_file": "alter_domain_null_type.sql"
}, {
"type": "alter",
"name": "Alter domain default expression",
"endpoint": "NODE-domain.obj_id",
"sql_endpoint": "NODE-domain.sql_id",
"data": {
"typdefault": "3"
},
"expected_sql_file": "alter_domain_default_expression.sql"
}, {
"type": "alter",
"name": "Alter domain name",
"endpoint": "NODE-domain.obj_id",
"sql_endpoint": "NODE-domain.sql_id",
"data": {
"name": "Dom2_$%{}[]()&*^!@\"'`\\/#"
},
"expected_sql_file": "alter_domain_name.sql"
}, {
"type": "delete",
"name": "Drop domain",
"endpoint": "NODE-domain.delete_id",
"data": {
"name": "Dom2_$%{}[]()&*^!@\"'`\\/#"
}
}
]
}