From 0ca65d7cfeaa52f58edc6eff5dd96a1b73aea360 Mon Sep 17 00:00:00 2001 From: Neel Patel Date: Mon, 2 Sep 2019 11:52:19 +0530 Subject: [PATCH] Added MSQL test cases for Domain. --- .../schemas/domains/tests/default/test.json | 69 ----------- .../{ => pg}/default/alter_domain_comment.sql | 10 +- .../alter_domain_default_expression.sql | 10 +- .../{ => pg}/default/alter_domain_name.sql | 10 +- .../default/alter_domain_null_type.sql | 10 +- .../tests/pg/default/create_domain.sql | 20 +++ .../default/create_domain_numeric.sql} | 9 +- .../pg/default/msql_alter_domain_comment.sql | 2 + .../msql_alter_domain_default_expression.sql | 2 + .../pg/default/msql_alter_domain_name.sql | 2 + .../default/msql_alter_domain_null_type.sql | 2 + .../tests/pg/default/msql_create_domain.sql | 16 +++ .../pg/default/msql_create_domain_numeric.sql | 9 ++ .../domains/tests/pg/default/test.json | 114 ++++++++++++++++++ .../ppas/default/alter_domain_comment.sql | 20 +++ .../alter_domain_default_expression.sql | 19 +++ .../tests/ppas/default/alter_domain_name.sql | 19 +++ .../ppas/default/alter_domain_null_type.sql | 19 +++ .../tests/ppas/default/create_domain.sql | 20 +++ .../ppas/default/create_domain_numeric.sql | 13 ++ .../default/msql_alter_domain_comment.sql | 2 + .../msql_alter_domain_default_expression.sql | 2 + .../ppas/default/msql_alter_domain_name.sql | 2 + .../default/msql_alter_domain_null_type.sql | 2 + .../tests/ppas/default/msql_create_domain.sql | 16 +++ .../default/msql_create_domain_numeric.sql | 9 ++ .../domains/tests/ppas/default/test.json | 114 ++++++++++++++++++ 27 files changed, 455 insertions(+), 87 deletions(-) delete mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/test.json rename web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/{ => pg}/default/alter_domain_comment.sql (55%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/{ => pg}/default/alter_domain_default_expression.sql (54%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/{ => pg}/default/alter_domain_name.sql (54%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/{ => pg}/default/alter_domain_null_type.sql (54%) create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/create_domain.sql rename web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/{default/create_domain.sql => pg/default/create_domain_numeric.sql} (55%) create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_comment.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_default_expression.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_name.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_null_type.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_create_domain.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_create_domain_numeric.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_comment.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_default_expression.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_name.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_null_type.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/create_domain.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/create_domain_numeric.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_comment.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_default_expression.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_name.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_null_type.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_create_domain.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_create_domain_numeric.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/test.json diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/test.json deleted file mode 100644 index fa8b38191..000000000 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/test.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "scenarios": [{ - "type": "create", - "name": "Create Domain", - "endpoint": "NODE-domain.obj", - "sql_endpoint": "NODE-domain.sql_id", - "data": { - "name": "Dom1_$%{}[]()&*^!@\"'`\\/#", - "schema": "public", - "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_$%{}[]()&*^!@\"'`\\/#" - } - } - ] -} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/alter_domain_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/alter_domain_comment.sql similarity index 55% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/alter_domain_comment.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/alter_domain_comment.sql index 27648cd9a..132f6ba8a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/alter_domain_comment.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/alter_domain_comment.sql @@ -3,14 +3,18 @@ -- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"; CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" - AS bigint + AS text + COLLATE pg_catalog."C" DEFAULT 5 NOT NULL; -ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO ; +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO postgres; ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" - ADD CONSTRAINT constraint_1 CHECK (true); + ADD CONSTRAINT constraint_1 CHECK (3 < 5); + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_2 CHECK (4 < 2) NOT VALID; COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" IS 'test updated domain comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/alter_domain_default_expression.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/alter_domain_default_expression.sql similarity index 54% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/alter_domain_default_expression.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/alter_domain_default_expression.sql index 7d9ca3560..6987a3381 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/alter_domain_default_expression.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/alter_domain_default_expression.sql @@ -3,13 +3,17 @@ -- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"; CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" - AS bigint + AS text + COLLATE pg_catalog."C" DEFAULT 3; -ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO ; +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO postgres; ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" - ADD CONSTRAINT constraint_1 CHECK (true); + ADD CONSTRAINT constraint_1 CHECK (3 < 5); + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_2 CHECK (4 < 2) NOT VALID; COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" IS 'test updated domain comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/alter_domain_name.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/alter_domain_name.sql similarity index 54% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/alter_domain_name.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/alter_domain_name.sql index 5b546dcf7..fad3d0f4c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/alter_domain_name.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/alter_domain_name.sql @@ -3,13 +3,17 @@ -- DROP DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#"; CREATE DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#" - AS bigint + AS text + COLLATE pg_catalog."C" DEFAULT 3; -ALTER DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#" OWNER TO ; +ALTER DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#" OWNER TO postgres; ALTER DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#" - ADD CONSTRAINT constraint_1 CHECK (true); + ADD CONSTRAINT constraint_1 CHECK (3 < 5); + +ALTER DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_2 CHECK (4 < 2) NOT VALID; COMMENT ON DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#" IS 'test updated domain comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/alter_domain_null_type.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/alter_domain_null_type.sql similarity index 54% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/alter_domain_null_type.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/alter_domain_null_type.sql index 1e0747a52..a8d6a3fac 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/alter_domain_null_type.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/alter_domain_null_type.sql @@ -3,13 +3,17 @@ -- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"; CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" - AS bigint + AS text + COLLATE pg_catalog."C" DEFAULT 5; -ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO ; +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO postgres; ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" - ADD CONSTRAINT constraint_1 CHECK (true); + ADD CONSTRAINT constraint_1 CHECK (3 < 5); + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_2 CHECK (4 < 2) NOT VALID; COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" IS 'test updated domain comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/create_domain.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/create_domain.sql new file mode 100644 index 000000000..246cbc1e3 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/create_domain.sql @@ -0,0 +1,20 @@ +-- DOMAIN: public."Dom1_$%{}[]()&*^!@""'`\/#" + +-- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"; + +CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + AS text + COLLATE pg_catalog."C" + DEFAULT 5 + NOT NULL; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO postgres; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_1 CHECK (3 < 5); + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_2 CHECK (4 < 2) NOT VALID; + +COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + IS 'test_comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/create_domain.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/create_domain_numeric.sql similarity index 55% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/create_domain.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/create_domain_numeric.sql index 0d3933521..81d572e22 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/default/create_domain.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/create_domain_numeric.sql @@ -3,14 +3,11 @@ -- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"; CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" - AS bigint - DEFAULT 5 + AS numeric(5,2) + DEFAULT 3 NOT NULL; -ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO ; - -ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" - ADD CONSTRAINT constraint_1 CHECK (true); +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO postgres; COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" IS 'test_comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_comment.sql new file mode 100644 index 000000000..8a4fb8644 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_comment.sql @@ -0,0 +1,2 @@ +COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + IS 'test updated domain comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_default_expression.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_default_expression.sql new file mode 100644 index 000000000..4321f7b56 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_default_expression.sql @@ -0,0 +1,2 @@ +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + SET DEFAULT 3; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_name.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_name.sql new file mode 100644 index 000000000..51a634176 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_name.sql @@ -0,0 +1,2 @@ +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + RENAME TO "Dom2_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_null_type.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_null_type.sql new file mode 100644 index 000000000..190e94b47 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_alter_domain_null_type.sql @@ -0,0 +1,2 @@ +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + DROP NOT NULL; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_create_domain.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_create_domain.sql new file mode 100644 index 000000000..5e4da15a3 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_create_domain.sql @@ -0,0 +1,16 @@ +CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + AS text + COLLATE pg_catalog."C" + DEFAULT 5 + NOT NULL; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO postgres; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_1 CHECK (3 < 5); + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_2 CHECK (4 < 2) NOT VALID; + +COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + IS 'test_comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_create_domain_numeric.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_create_domain_numeric.sql new file mode 100644 index 000000000..9feccd2db --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/msql_create_domain_numeric.sql @@ -0,0 +1,9 @@ +CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + AS numeric(5,2) + DEFAULT 3 + NOT NULL; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO postgres; + +COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + IS 'test_comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/test.json new file mode 100644 index 000000000..2b23970c5 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/pg/default/test.json @@ -0,0 +1,114 @@ +{ + "scenarios": [{ + "type": "create", + "name": "Create Domain with all options", + "endpoint": "NODE-domain.obj", + "sql_endpoint": "NODE-domain.sql_id", + "msql_endpoint": "NODE-domain.msql", + "data": { + "name": "Dom1_$%{}[]()&*^!@\"'`\\/#", + "schema": "public", + "schema_id": "", + "owner": "postgres", + "basensp": "public", + "description": "test_comment", + "basetype": "text", + "collname": "pg_catalog.\"C\"", + "typdefault": "5", + "typnotnull": "true", + "constraints": [{ + "conname": "constraint_1", + "consrc": "3 < 5", + "convalidated": true + }, { + "conname": "constraint_2", + "consrc": "4 < 2", + "convalidated": false + }], + "seclabels": [] + }, + "expected_sql_file": "create_domain.sql", + "expected_msql_file": "msql_create_domain.sql" + }, { + "type": "alter", + "name": "Alter domain comment", + "endpoint": "NODE-domain.obj_id", + "sql_endpoint": "NODE-domain.sql_id", + "msql_endpoint": "NODE-domain.msql_id", + "data": { + "description": "test updated domain comment" + }, + "expected_sql_file": "alter_domain_comment.sql", + "expected_msql_file": "msql_alter_domain_comment.sql" + }, { + "type": "alter", + "name": "Alter domain null type", + "endpoint": "NODE-domain.obj_id", + "sql_endpoint": "NODE-domain.sql_id", + "msql_endpoint": "NODE-domain.msql_id", + "data": { + "typnotnull": "false" + }, + "expected_sql_file": "alter_domain_null_type.sql", + "expected_msql_file": "msql_alter_domain_null_type.sql" + }, { + "type": "alter", + "name": "Alter domain default expression", + "endpoint": "NODE-domain.obj_id", + "sql_endpoint": "NODE-domain.sql_id", + "msql_endpoint": "NODE-domain.msql_id", + "data": { + "typdefault": "3" + }, + "expected_sql_file": "alter_domain_default_expression.sql", + "expected_msql_file": "msql_alter_domain_default_expression.sql" + }, { + "type": "alter", + "name": "Alter domain name", + "endpoint": "NODE-domain.obj_id", + "sql_endpoint": "NODE-domain.sql_id", + "msql_endpoint": "NODE-domain.msql_id", + "data": { + "name": "Dom2_$%{}[]()&*^!@\"'`\\/#" + }, + "expected_sql_file": "alter_domain_name.sql", + "expected_msql_file": "msql_alter_domain_name.sql" + }, { + "type": "delete", + "name": "Drop domain of text data type", + "endpoint": "NODE-domain.delete_id", + "data": { + "name": "Dom2_$%{}[]()&*^!@\"'`\\/#" + } + }, { + "type": "create", + "name": "Create Domain with numeric data type", + "endpoint": "NODE-domain.obj", + "sql_endpoint": "NODE-domain.sql_id", + "msql_endpoint": "NODE-domain.msql", + "data": { + "name": "Dom1_$%{}[]()&*^!@\"'`\\/#", + "schema": "public", + "schema_id": "", + "owner": "postgres", + "basensp": "public", + "description": "test_comment", + "basetype": "numeric", + "typlen": 5, + "precision": 2, + "typdefault": "3", + "typnotnull": "true", + "seclabels": [] + }, + "expected_sql_file": "create_domain_numeric.sql", + "expected_msql_file": "msql_create_domain_numeric.sql" + }, { + "type": "delete", + "name": "Drop domain of numeric data type", + "endpoint": "NODE-domain.delete_id", + "data": { + "name": "Dom2_$%{}[]()&*^!@\"'`\\/#" + } + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_comment.sql new file mode 100644 index 000000000..4e430fc64 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_comment.sql @@ -0,0 +1,20 @@ +-- DOMAIN: public."Dom1_$%{}[]()&*^!@""'`\/#" + +-- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"; + +CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + AS text + COLLATE pg_catalog."C" + DEFAULT 5 + NOT NULL; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO enterprisedb; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_1 CHECK (3 < 5); + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_2 CHECK (4 < 2) NOT VALID; + +COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + IS 'test updated domain comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_default_expression.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_default_expression.sql new file mode 100644 index 000000000..d6df44a8d --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_default_expression.sql @@ -0,0 +1,19 @@ +-- DOMAIN: public."Dom1_$%{}[]()&*^!@""'`\/#" + +-- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"; + +CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + AS text + COLLATE pg_catalog."C" + DEFAULT 3; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO enterprisedb; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_1 CHECK (3 < 5); + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_2 CHECK (4 < 2) NOT VALID; + +COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + IS 'test updated domain comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_name.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_name.sql new file mode 100644 index 000000000..dde706dae --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_name.sql @@ -0,0 +1,19 @@ +-- DOMAIN: public."Dom2_$%{}[]()&*^!@""'`\/#" + +-- DROP DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#"; + +CREATE DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#" + AS text + COLLATE pg_catalog."C" + DEFAULT 3; + +ALTER DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#" OWNER TO enterprisedb; + +ALTER DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_1 CHECK (3 < 5); + +ALTER DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_2 CHECK (4 < 2) NOT VALID; + +COMMENT ON DOMAIN public."Dom2_$%{}[]()&*^!@""'`\/#" + IS 'test updated domain comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_null_type.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_null_type.sql new file mode 100644 index 000000000..3ac89e3df --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/alter_domain_null_type.sql @@ -0,0 +1,19 @@ +-- DOMAIN: public."Dom1_$%{}[]()&*^!@""'`\/#" + +-- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"; + +CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + AS text + COLLATE pg_catalog."C" + DEFAULT 5; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO enterprisedb; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_1 CHECK (3 < 5); + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_2 CHECK (4 < 2) NOT VALID; + +COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + IS 'test updated domain comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/create_domain.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/create_domain.sql new file mode 100644 index 000000000..ba9c72f09 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/create_domain.sql @@ -0,0 +1,20 @@ +-- DOMAIN: public."Dom1_$%{}[]()&*^!@""'`\/#" + +-- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"; + +CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + AS text + COLLATE pg_catalog."C" + DEFAULT 5 + NOT NULL; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO enterprisedb; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_1 CHECK (3 < 5); + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_2 CHECK (4 < 2) NOT VALID; + +COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + IS 'test_comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/create_domain_numeric.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/create_domain_numeric.sql new file mode 100644 index 000000000..2462f685e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/create_domain_numeric.sql @@ -0,0 +1,13 @@ +-- DOMAIN: public."Dom1_$%{}[]()&*^!@""'`\/#" + +-- DROP DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#"; + +CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + AS numeric(5,2) + DEFAULT 3 + NOT NULL; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO enterprisedb; + +COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + IS 'test_comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_comment.sql new file mode 100644 index 000000000..8a4fb8644 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_comment.sql @@ -0,0 +1,2 @@ +COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + IS 'test updated domain comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_default_expression.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_default_expression.sql new file mode 100644 index 000000000..4321f7b56 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_default_expression.sql @@ -0,0 +1,2 @@ +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + SET DEFAULT 3; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_name.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_name.sql new file mode 100644 index 000000000..51a634176 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_name.sql @@ -0,0 +1,2 @@ +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + RENAME TO "Dom2_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_null_type.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_null_type.sql new file mode 100644 index 000000000..190e94b47 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_alter_domain_null_type.sql @@ -0,0 +1,2 @@ +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + DROP NOT NULL; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_create_domain.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_create_domain.sql new file mode 100644 index 000000000..6eb5affcb --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_create_domain.sql @@ -0,0 +1,16 @@ +CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + AS text + COLLATE pg_catalog."C" + DEFAULT 5 + NOT NULL; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO enterprisedb; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_1 CHECK (3 < 5); + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT constraint_2 CHECK (4 < 2) NOT VALID; + +COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + IS 'test_comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_create_domain_numeric.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_create_domain_numeric.sql new file mode 100644 index 000000000..bd21ebc38 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/msql_create_domain_numeric.sql @@ -0,0 +1,9 @@ +CREATE DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + AS numeric(5,2) + DEFAULT 3 + NOT NULL; + +ALTER DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" OWNER TO enterprisedb; + +COMMENT ON DOMAIN public."Dom1_$%{}[]()&*^!@""'`\/#" + IS 'test_comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/test.json new file mode 100644 index 000000000..0cb7167de --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/tests/ppas/default/test.json @@ -0,0 +1,114 @@ +{ + "scenarios": [{ + "type": "create", + "name": "Create Domain with all options", + "endpoint": "NODE-domain.obj", + "sql_endpoint": "NODE-domain.sql_id", + "msql_endpoint": "NODE-domain.msql", + "data": { + "name": "Dom1_$%{}[]()&*^!@\"'`\\/#", + "schema": "public", + "schema_id": "", + "owner": "enterprisedb", + "basensp": "public", + "description": "test_comment", + "basetype": "text", + "collname": "pg_catalog.\"C\"", + "typdefault": "5", + "typnotnull": "true", + "constraints": [{ + "conname": "constraint_1", + "consrc": "3 < 5", + "convalidated": true + },{ + "conname": "constraint_2", + "consrc": "4 < 2", + "convalidated": false + }], + "seclabels": [] + }, + "expected_sql_file": "create_domain.sql", + "expected_msql_file": "msql_create_domain.sql" + }, { + "type": "alter", + "name": "Alter domain comment", + "endpoint": "NODE-domain.obj_id", + "sql_endpoint": "NODE-domain.sql_id", + "msql_endpoint": "NODE-domain.msql_id", + "data": { + "description": "test updated domain comment" + }, + "expected_sql_file": "alter_domain_comment.sql", + "expected_msql_file": "msql_alter_domain_comment.sql" + }, { + "type": "alter", + "name": "Alter domain null type", + "endpoint": "NODE-domain.obj_id", + "sql_endpoint": "NODE-domain.sql_id", + "msql_endpoint": "NODE-domain.msql_id", + "data": { + "typnotnull": "false" + }, + "expected_sql_file": "alter_domain_null_type.sql", + "expected_msql_file": "msql_alter_domain_null_type.sql" + }, { + "type": "alter", + "name": "Alter domain default expression", + "endpoint": "NODE-domain.obj_id", + "sql_endpoint": "NODE-domain.sql_id", + "msql_endpoint": "NODE-domain.msql_id", + "data": { + "typdefault": "3" + }, + "expected_sql_file": "alter_domain_default_expression.sql", + "expected_msql_file": "msql_alter_domain_default_expression.sql" + }, { + "type": "alter", + "name": "Alter domain name", + "endpoint": "NODE-domain.obj_id", + "sql_endpoint": "NODE-domain.sql_id", + "msql_endpoint": "NODE-domain.msql_id", + "data": { + "name": "Dom2_$%{}[]()&*^!@\"'`\\/#" + }, + "expected_sql_file": "alter_domain_name.sql", + "expected_msql_file": "msql_alter_domain_name.sql" + }, { + "type": "delete", + "name": "Drop domain of text data type", + "endpoint": "NODE-domain.delete_id", + "data": { + "name": "Dom2_$%{}[]()&*^!@\"'`\\/#" + } + }, { + "type": "create", + "name": "Create Domain with numeric data type", + "endpoint": "NODE-domain.obj", + "sql_endpoint": "NODE-domain.sql_id", + "msql_endpoint": "NODE-domain.msql", + "data": { + "name": "Dom1_$%{}[]()&*^!@\"'`\\/#", + "schema": "public", + "schema_id": "", + "owner": "enterprisedb", + "basensp": "public", + "description": "test_comment", + "basetype": "numeric", + "typlen": 5, + "precision": 2, + "typdefault": "3", + "typnotnull": "true", + "seclabels": [] + }, + "expected_sql_file": "create_domain_numeric.sql", + "expected_msql_file": "msql_create_domain_numeric.sql" + }, { + "type": "delete", + "name": "Drop domain of numeric data type", + "endpoint": "NODE-domain.delete_id", + "data": { + "name": "Dom2_$%{}[]()&*^!@\"'`\\/#" + } + } + ] +}