From faa623658035de48bf10820b8664284036ac3269 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Fri, 20 Sep 2019 12:12:01 +0530 Subject: [PATCH] Add Reverse Engineered and Modified SQL tests for Unique Constraints. Fixes #4628 --- docs/en_US/release_notes.rst | 1 + docs/en_US/release_notes_4_14.rst | 18 +++ ...nstraint.sql => alter_pkey_constraint.sql} | 6 +- .../alter_pkey_constraint_msql.sql} | 4 +- .../alter_pkey_constraint_with_index.sql} | 6 +- ...alter_pkey_constraint_with_index_msql.sql} | 4 +- ...or.sql => alter_pkey_reset_fillfactor.sql} | 6 +- ...l => alter_pkey_reset_fillfactor_msql.sql} | 0 .../tests/11_plus/alter_unique_constraint.sql | 12 ++ .../11_plus/alter_unique_constraint_msql.sql | 6 + .../alter_unique_constraint_with_index.sql | 11 ++ ...lter_unique_constraint_with_index_msql.sql | 6 + .../11_plus/alter_unique_reset_fillfactor.sql | 12 ++ .../alter_unique_reset_fillfactor_msql.sql | 2 + ...reate_msql_index_constraint_with_index.sql | 6 - ...straint.sql => create_pkey_constraint.sql} | 6 +- ...nt.sql => create_pkey_constraint_msql.sql} | 4 +- ... => create_pkey_constraint_with_index.sql} | 6 +- ...create_pkey_constraint_with_index_msql.sql | 5 + .../11_plus/create_unique_constraint.sql | 12 ++ .../11_plus/create_unique_constraint_msql.sql | 8 ++ .../create_unique_constraint_with_index.sql | 10 ++ ...eate_unique_constraint_with_index_msql.sql | 5 + .../{test.json => test_primary_key.json} | 25 ++-- .../tests/11_plus/test_unique_constraint.json | 132 ++++++++++++++++++ ...nstraint.sql => alter_pkey_constraint.sql} | 6 +- .../alter_pkey_constraint_msql.sql} | 4 +- .../alter_pkey_constraint_with_index.sql} | 6 +- ...alter_pkey_constraint_with_index_msql.sql} | 4 +- ...or.sql => alter_pkey_reset_fillfactor.sql} | 6 +- ...l => alter_pkey_reset_fillfactor_msql.sql} | 0 .../tests/default/alter_unique_constraint.sql | 11 ++ .../default/alter_unique_constraint_msql.sql | 6 + .../alter_unique_constraint_with_index.sql | 11 ++ ...lter_unique_constraint_with_index_msql.sql | 6 + .../default/alter_unique_reset_fillfactor.sql | 11 ++ .../alter_unique_reset_fillfactor_msql.sql | 2 + ...reate_msql_index_constraint_with_index.sql | 6 - ...straint.sql => create_pkey_constraint.sql} | 6 +- ...nt.sql => create_pkey_constraint_msql.sql} | 4 +- ... => create_pkey_constraint_with_index.sql} | 6 +- ...create_pkey_constraint_with_index_msql.sql | 5 + .../default/create_unique_constraint.sql | 11 ++ .../default/create_unique_constraint_msql.sql | 7 + .../create_unique_constraint_with_index.sql | 10 ++ ...eate_unique_constraint_with_index_msql.sql | 5 + .../{test.json => test_primary_key.json} | 25 ++-- .../tests/default/test_unique_constraint.json | 127 +++++++++++++++++ 48 files changed, 522 insertions(+), 76 deletions(-) create mode 100644 docs/en_US/release_notes_4_14.rst rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/{alter_index_constraint.sql => alter_pkey_constraint.sql} (62%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/{default/alter_msql_index_constraint.sql => 11_plus/alter_pkey_constraint_msql.sql} (76%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/{default/alter_index_constraint_with_index.sql => 11_plus/alter_pkey_constraint_with_index.sql} (57%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/{default/alter_msql_index_constraint_with_index.sql => 11_plus/alter_pkey_constraint_with_index_msql.sql} (76%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/{alter_reset_fillfactor.sql => alter_pkey_reset_fillfactor.sql} (59%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/{alter_msql_reset_fillfactor.sql => alter_pkey_reset_fillfactor_msql.sql} (100%) create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint_with_index.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint_with_index_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_reset_fillfactor.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_reset_fillfactor_msql.sql delete mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_msql_index_constraint_with_index.sql rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/{create_index_constraint.sql => create_pkey_constraint.sql} (62%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/{create_msql_index_constraint.sql => create_pkey_constraint_msql.sql} (76%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/{create_index_constraint_with_index.sql => create_pkey_constraint_with_index.sql} (57%) create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_pkey_constraint_with_index_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint_with_index.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint_with_index_msql.sql rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/{test.json => test_primary_key.json} (80%) create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/test_unique_constraint.json rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/{alter_index_constraint.sql => alter_pkey_constraint.sql} (60%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/{11_plus/alter_msql_index_constraint.sql => default/alter_pkey_constraint_msql.sql} (76%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/{11_plus/alter_index_constraint_with_index.sql => default/alter_pkey_constraint_with_index.sql} (57%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/{11_plus/alter_msql_index_constraint_with_index.sql => default/alter_pkey_constraint_with_index_msql.sql} (76%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/{alter_reset_fillfactor.sql => alter_pkey_reset_fillfactor.sql} (58%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/{alter_msql_reset_fillfactor.sql => alter_pkey_reset_fillfactor_msql.sql} (100%) create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint_with_index.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint_with_index_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_reset_fillfactor.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_reset_fillfactor_msql.sql delete mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_msql_index_constraint_with_index.sql rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/{create_index_constraint.sql => create_pkey_constraint.sql} (60%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/{create_msql_index_constraint.sql => create_pkey_constraint_msql.sql} (74%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/{create_index_constraint_with_index.sql => create_pkey_constraint_with_index.sql} (57%) create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_pkey_constraint_with_index_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint_with_index.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint_with_index_msql.sql rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/{test.json => test_primary_key.json} (79%) create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/test_unique_constraint.json diff --git a/docs/en_US/release_notes.rst b/docs/en_US/release_notes.rst index 89783bb7c..d670dc4bc 100644 --- a/docs/en_US/release_notes.rst +++ b/docs/en_US/release_notes.rst @@ -11,6 +11,7 @@ notes for it. .. toctree:: :maxdepth: 1 + release_notes_4_14 release_notes_4_13 release_notes_4_12 release_notes_4_11 diff --git a/docs/en_US/release_notes_4_14.rst b/docs/en_US/release_notes_4_14.rst new file mode 100644 index 000000000..66f78fb1d --- /dev/null +++ b/docs/en_US/release_notes_4_14.rst @@ -0,0 +1,18 @@ +************ +Version 4.14 +************ + +Release date: 2019-10-17 + +This release contains a number of bug fixes and new features since the release of pgAdmin4 4.13. + +New features +************ + +Housekeeping +************ + +| `Issue #4628 `_ - Add Reverse Engineered and Modified SQL tests for Unique Constraints. + +Bug fixes +********* diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_index_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_constraint.sql similarity index 62% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_index_constraint.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_constraint.sql index dc3cf3dab..6a867ba91 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_index_constraint.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_constraint.sql @@ -1,13 +1,13 @@ -- Constraint: Pk_$%{}[]()&*^!@"'`\/#a --- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a"; +-- ALTER TABLE testschema.tablefor_primary_key_cons DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a"; -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" PRIMARY KEY (col1) INCLUDE (col2) WITH (FILLFACTOR=90) DEFERRABLE INITIALLY DEFERRED; -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_primary_key_cons IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_msql_index_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_constraint_msql.sql similarity index 76% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_msql_index_constraint.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_constraint_msql.sql index 7031f24f9..a309837aa 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_msql_index_constraint.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_constraint_msql.sql @@ -1,6 +1,6 @@ -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons RENAME CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" TO "Pk_$%{}[]()&*^!@""'`\/#a"; ALTER INDEX testschema."Pk_$%{}[]()&*^!@""'`\/#a" SET (FILLFACTOR=90); -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_primary_key_cons IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_index_constraint_with_index.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_constraint_with_index.sql similarity index 57% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_index_constraint_with_index.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_constraint_with_index.sql index d5c2dc067..1a720e36b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_index_constraint_with_index.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_constraint_with_index.sql @@ -1,11 +1,11 @@ -- Constraint: Pk_$%{}[]()&*^!@"'`\/#a --- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a"; +-- ALTER TABLE testschema.tablefor_primary_key_cons DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a"; -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" PRIMARY KEY (col1) WITH (FILLFACTOR=90); -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_primary_key_cons IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_msql_index_constraint_with_index.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_constraint_with_index_msql.sql similarity index 76% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_msql_index_constraint_with_index.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_constraint_with_index_msql.sql index 7031f24f9..a309837aa 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_msql_index_constraint_with_index.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_constraint_with_index_msql.sql @@ -1,6 +1,6 @@ -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons RENAME CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" TO "Pk_$%{}[]()&*^!@""'`\/#a"; ALTER INDEX testschema."Pk_$%{}[]()&*^!@""'`\/#a" SET (FILLFACTOR=90); -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_primary_key_cons IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_reset_fillfactor.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_reset_fillfactor.sql similarity index 59% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_reset_fillfactor.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_reset_fillfactor.sql index ff37018cb..c97b44cde 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_reset_fillfactor.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_reset_fillfactor.sql @@ -1,12 +1,12 @@ -- Constraint: Pk_$%{}[]()&*^!@"'`\/#a --- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a"; +-- ALTER TABLE testschema.tablefor_primary_key_cons DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a"; -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" PRIMARY KEY (col1) INCLUDE (col2) DEFERRABLE INITIALLY DEFERRED; -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_primary_key_cons IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_msql_reset_fillfactor.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_reset_fillfactor_msql.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_msql_reset_fillfactor.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_pkey_reset_fillfactor_msql.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint.sql new file mode 100644 index 000000000..32a23c878 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint.sql @@ -0,0 +1,12 @@ +-- Constraint: UC_$%{}[]()&*^!@"'`\/#a + +-- ALTER TABLE testschema.tablefor_unique_cons DROP CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a"; + +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" UNIQUE (col1) + INCLUDE (col2) + WITH (FILLFACTOR=90) + DEFERRABLE INITIALLY DEFERRED; + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_unique_cons + IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint_msql.sql new file mode 100644 index 000000000..7d1f9e45a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint_msql.sql @@ -0,0 +1,6 @@ +ALTER TABLE testschema.tablefor_unique_cons + RENAME CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" TO "UC_$%{}[]()&*^!@""'`\/#a"; +ALTER INDEX testschema."UC_$%{}[]()&*^!@""'`\/#a" + SET (FILLFACTOR=90); +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_unique_cons + IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint_with_index.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint_with_index.sql new file mode 100644 index 000000000..523703f73 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint_with_index.sql @@ -0,0 +1,11 @@ +-- Constraint: UC_$%{}[]()&*^!@"'`\/#a + +-- ALTER TABLE testschema.tablefor_unique_cons DROP CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a"; + +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" UNIQUE (col1) + WITH (FILLFACTOR=90); + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_unique_cons + IS 'Comment for alter'; + diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint_with_index_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint_with_index_msql.sql new file mode 100644 index 000000000..7d1f9e45a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_constraint_with_index_msql.sql @@ -0,0 +1,6 @@ +ALTER TABLE testschema.tablefor_unique_cons + RENAME CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" TO "UC_$%{}[]()&*^!@""'`\/#a"; +ALTER INDEX testschema."UC_$%{}[]()&*^!@""'`\/#a" + SET (FILLFACTOR=90); +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_unique_cons + IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_reset_fillfactor.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_reset_fillfactor.sql new file mode 100644 index 000000000..ad757f2f1 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_reset_fillfactor.sql @@ -0,0 +1,12 @@ +-- Constraint: UC_$%{}[]()&*^!@"'`\/#a + +-- ALTER TABLE testschema.tablefor_unique_cons DROP CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a"; + +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" UNIQUE (col1) + INCLUDE (col2) + DEFERRABLE INITIALLY DEFERRED; + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_unique_cons + IS 'Comment for alter'; + diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_reset_fillfactor_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_reset_fillfactor_msql.sql new file mode 100644 index 000000000..4560538d4 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_unique_reset_fillfactor_msql.sql @@ -0,0 +1,2 @@ +ALTER INDEX testschema."UC_$%{}[]()&*^!@""'`\/#a" + RESET (FILLFACTOR); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_msql_index_constraint_with_index.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_msql_index_constraint_with_index.sql deleted file mode 100644 index e1e943668..000000000 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_msql_index_constraint_with_index.sql +++ /dev/null @@ -1,6 +0,0 @@ -ALTER TABLE testschema.tableforindexcon - ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1) - WITH (FILLFACTOR=20); - -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon - IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_index_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_pkey_constraint.sql similarity index 62% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_index_constraint.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_pkey_constraint.sql index 2fcf106ae..84aeb4093 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_index_constraint.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_pkey_constraint.sql @@ -1,12 +1,12 @@ -- Constraint: Pk_$%{}[]()&*^!@"'`\/# --- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#"; +-- ALTER TABLE testschema.tablefor_primary_key_cons DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#"; -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1) INCLUDE (col2) WITH (FILLFACTOR=20) DEFERRABLE INITIALLY DEFERRED; -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_primary_key_cons IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_msql_index_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_pkey_constraint_msql.sql similarity index 76% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_msql_index_constraint.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_pkey_constraint_msql.sql index 433a42643..cc794c94f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_msql_index_constraint.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_pkey_constraint_msql.sql @@ -1,8 +1,8 @@ -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1) INCLUDE (col2) WITH (FILLFACTOR=20) DEFERRABLE INITIALLY DEFERRED; -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_primary_key_cons IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_index_constraint_with_index.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_pkey_constraint_with_index.sql similarity index 57% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_index_constraint_with_index.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_pkey_constraint_with_index.sql index 70aa78d4b..c6da21c48 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_index_constraint_with_index.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_pkey_constraint_with_index.sql @@ -1,10 +1,10 @@ -- Constraint: Pk_$%{}[]()&*^!@"'`\/# --- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#"; +-- ALTER TABLE testschema.tablefor_primary_key_cons DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#"; -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1) WITH (FILLFACTOR=20); -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_primary_key_cons IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_pkey_constraint_with_index_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_pkey_constraint_with_index_msql.sql new file mode 100644 index 000000000..bdbb820cf --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_pkey_constraint_with_index_msql.sql @@ -0,0 +1,5 @@ +ALTER TABLE testschema.tablefor_primary_key_cons + ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY USING INDEX uindex; + +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_primary_key_cons + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint.sql new file mode 100644 index 000000000..180037f77 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint.sql @@ -0,0 +1,12 @@ +-- Constraint: UC_$%{}[]()&*^!@"'`\/# + +-- ALTER TABLE testschema.tablefor_unique_cons DROP CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" UNIQUE (col1) + INCLUDE (col2) + WITH (FILLFACTOR=20) + DEFERRABLE INITIALLY DEFERRED; + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_unique_cons + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint_msql.sql new file mode 100644 index 000000000..afcce154f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint_msql.sql @@ -0,0 +1,8 @@ +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" UNIQUE (col1) + INCLUDE (col2) + WITH (FILLFACTOR=20) + DEFERRABLE INITIALLY DEFERRED; + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_unique_cons + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint_with_index.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint_with_index.sql new file mode 100644 index 000000000..83c3e289e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint_with_index.sql @@ -0,0 +1,10 @@ +-- Constraint: UC_$%{}[]()&*^!@"'`\/# + +-- ALTER TABLE testschema.tablefor_unique_cons DROP CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" UNIQUE (col1) + WITH (FILLFACTOR=20); + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_unique_cons + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint_with_index_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint_with_index_msql.sql new file mode 100644 index 000000000..bb1f7c650 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/create_unique_constraint_with_index_msql.sql @@ -0,0 +1,5 @@ +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" UNIQUE USING INDEX uindex; + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_unique_cons + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/test_primary_key.json similarity index 80% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/test.json rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/test_primary_key.json index 6973f7915..f231e6581 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/test_primary_key.json @@ -6,7 +6,7 @@ "endpoint": "NODE-table.obj", "sql_endpoint": "NODE-table.sql_id", "data": { - "name": "tableforindexcon", + "name": "tablefor_primary_key_cons", "columns": [{ "name": "col1", "cltype": "integer", @@ -44,6 +44,7 @@ "name": "Create Primary Key Constraint -- 11 Plus", "endpoint": "NODE-primary_key.obj", "sql_endpoint": "NODE-primary_key.sql_id", + "msql_endpoint": "NODE-primary_key.msql", "data": { "name": "Pk_$%{}[]()&*^!@\"'`\\/#", "comment": "Comment for create", @@ -53,8 +54,8 @@ "condeferrable": true, "condeferred": true }, - "expected_sql_file": "create_index_constraint.sql", - "expected_msql_file": "create_msql_index_constraint.sql" + "expected_sql_file": "create_pkey_constraint.sql", + "expected_msql_file": "create_pkey_constraint_msql.sql" }, { "type": "alter", "name": "Alter Primary Key Constraint -- 11 Plus", @@ -66,8 +67,8 @@ "fillfactor": 90, "comment": "Comment for alter" }, - "expected_sql_file": "alter_index_constraint.sql", - "expected_msql_file": "alter_msql_index_constraint.sql" + "expected_sql_file": "alter_pkey_constraint.sql", + "expected_msql_file": "alter_pkey_constraint_msql.sql" }, { "type": "alter", "name": "Alter Primary Key Constraint Reset Fill factor", @@ -77,8 +78,8 @@ "data": { "fillfactor": "" }, - "expected_sql_file": "alter_reset_fillfactor.sql", - "expected_msql_file": "alter_msql_reset_fillfactor.sql" + "expected_sql_file": "alter_pkey_reset_fillfactor.sql", + "expected_msql_file": "alter_pkey_reset_fillfactor_msql.sql" }, { "type": "delete", "name": "Drop Primary Key Constraint -- 11 plus", @@ -91,12 +92,14 @@ "name": "Create Primary Key Constraint with Index -- 11 plus", "endpoint": "NODE-primary_key.obj", "sql_endpoint": "NODE-primary_key.sql_id", + "msql_endpoint": "NODE-primary_key.msql", "data": { "name": "Pk_$%{}[]()&*^!@\"'`\\/#", "comment": "Comment for create", "index": "uindex" }, - "expected_sql_file": "create_index_constraint_with_index.sql" + "expected_sql_file": "create_pkey_constraint_with_index.sql", + "expected_msql_file": "create_pkey_constraint_with_index_msql.sql" }, { "type": "alter", "name": "Alter Primary Key Constraint with Index -- 11 plus", @@ -108,8 +111,8 @@ "fillfactor": 90, "comment": "Comment for alter" }, - "expected_sql_file": "alter_index_constraint_with_index.sql", - "expected_msql_file": "alter_msql_index_constraint_with_index.sql" + "expected_sql_file": "alter_pkey_constraint_with_index.sql", + "expected_msql_file": "alter_pkey_constraint_with_index_msql.sql" }, { "type": "delete", "name": "Drop Primary Key Constraint with Index -- 11 plus", @@ -122,7 +125,7 @@ "name": "Drop Index Constraint Table -- 11 plus", "endpoint": "NODE-table.delete_id", "data": { - "name": "tableforindexcon" + "name": "tablefor_primary_key_cons" } } ] diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/test_unique_constraint.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/test_unique_constraint.json new file mode 100644 index 000000000..a90e03635 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/test_unique_constraint.json @@ -0,0 +1,132 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "tablefor_unique_cons", + "columns": [{ + "name": "col1", + "cltype": "integer", + "is_primary_key": false + }, { + "name": "col2", + "cltype": "integer", + "is_primary_key": false + }], + "is_partitioned": false, + "schema": "testschema", + "spcname": "pg_default" + }, + "store_object_id": true + }, { + "type": "create", + "name": "Create Index", + "endpoint": "NODE-index.obj", + "sql_endpoint": "NODE-index.sql_id", + "data": { + "name": "uindex", + "spcname": "pg_default", + "amname": "btree", + "columns": [{ + "colname": "col1", + "sort_order": false, + "nulls": false, + "is_sort_nulls_applicable": true + }], + "indisunique": true, + "fillfactor": 20 + } + }, { + "type": "create", + "name": "Create Unique Constraint -- 11 Plus", + "endpoint": "NODE-unique_constraint.obj", + "sql_endpoint": "NODE-unique_constraint.sql_id", + "msql_endpoint": "NODE-unique_constraint.msql", + "data": { + "name": "UC_$%{}[]()&*^!@\"'`\\/#", + "comment": "Comment for create", + "fillfactor": 20, + "columns": [{"column":"col1"}], + "include": ["col2"], + "condeferrable": true, + "condeferred": true + }, + "expected_sql_file": "create_unique_constraint.sql", + "expected_msql_file": "create_unique_constraint_msql.sql" + }, { + "type": "alter", + "name": "Alter Unique Constraint -- 11 Plus", + "endpoint": "NODE-unique_constraint.obj_id", + "sql_endpoint": "NODE-unique_constraint.sql_id", + "msql_endpoint": "NODE-unique_constraint.msql_id", + "data": { + "name": "UC_$%{}[]()&*^!@\"'`\\/#a", + "fillfactor": 90, + "comment": "Comment for alter" + }, + "expected_sql_file": "alter_unique_constraint.sql", + "expected_msql_file": "alter_unique_constraint_msql.sql" + }, { + "type": "alter", + "name": "Alter Unique Constraint Reset Fill factor", + "endpoint": "NODE-unique_constraint.obj_id", + "sql_endpoint": "NODE-unique_constraint.sql_id", + "msql_endpoint": "NODE-unique_constraint.msql_id", + "data": { + "fillfactor": "" + }, + "expected_sql_file": "alter_unique_reset_fillfactor.sql", + "expected_msql_file": "alter_unique_reset_fillfactor_msql.sql" + }, { + "type": "delete", + "name": "Drop Unique Constraint -- 11 Plus", + "endpoint": "NODE-unique_constraint.delete_id", + "data": { + "name": "UC_$%{}[]()&*^!@\"'`\\/#a" + } + }, { + "type": "create", + "name": "Create Unique Constraint with Index -- 11 Plus", + "endpoint": "NODE-unique_constraint.obj", + "sql_endpoint": "NODE-unique_constraint.sql_id", + "msql_endpoint": "NODE-unique_constraint.msql", + "data": { + "name": "UC_$%{}[]()&*^!@\"'`\\/#", + "comment": "Comment for create", + "index": "uindex" + }, + "expected_sql_file": "create_unique_constraint_with_index.sql", + "expected_msql_file": "create_unique_constraint_with_index_msql.sql" + }, { + "type": "alter", + "name": "Alter Unique Constraint with Index -- 11 Plus", + "endpoint": "NODE-unique_constraint.obj_id", + "sql_endpoint": "NODE-unique_constraint.sql_id", + "msql_endpoint": "NODE-unique_constraint.msql_id", + "data": { + "name": "UC_$%{}[]()&*^!@\"'`\\/#a", + "fillfactor": 90, + "comment": "Comment for alter" + }, + "expected_sql_file": "alter_unique_constraint_with_index.sql", + "expected_msql_file": "alter_unique_constraint_with_index_msql.sql" + }, { + "type": "delete", + "name": "Drop Unique Constraint -- 11 Plus", + "endpoint": "NODE-unique_constraint.delete_id", + "data": { + "name": "UC_$%{}[]()&*^!@\"'`\\/#a" + } + }, { + "type": "delete", + "name": "Drop Unique Constraint Table -- 11 Plus", + "endpoint": "NODE-table.delete_id", + "data": { + "name": "tablefor_unique_cons" + } + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_index_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_constraint.sql similarity index 60% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_index_constraint.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_constraint.sql index 0af807b99..8715af09f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_index_constraint.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_constraint.sql @@ -1,12 +1,12 @@ -- Constraint: Pk_$%{}[]()&*^!@"'`\/#a --- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a"; +-- ALTER TABLE testschema.tablefor_primary_key_cons DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a"; -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" PRIMARY KEY (col1) WITH (FILLFACTOR=90) DEFERRABLE INITIALLY DEFERRED; -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_primary_key_cons IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_msql_index_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_constraint_msql.sql similarity index 76% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_msql_index_constraint.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_constraint_msql.sql index 7031f24f9..a309837aa 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_msql_index_constraint.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_constraint_msql.sql @@ -1,6 +1,6 @@ -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons RENAME CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" TO "Pk_$%{}[]()&*^!@""'`\/#a"; ALTER INDEX testschema."Pk_$%{}[]()&*^!@""'`\/#a" SET (FILLFACTOR=90); -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_primary_key_cons IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_index_constraint_with_index.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_constraint_with_index.sql similarity index 57% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_index_constraint_with_index.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_constraint_with_index.sql index d5c2dc067..1a720e36b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_index_constraint_with_index.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_constraint_with_index.sql @@ -1,11 +1,11 @@ -- Constraint: Pk_$%{}[]()&*^!@"'`\/#a --- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a"; +-- ALTER TABLE testschema.tablefor_primary_key_cons DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a"; -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" PRIMARY KEY (col1) WITH (FILLFACTOR=90); -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_primary_key_cons IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_msql_index_constraint_with_index.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_constraint_with_index_msql.sql similarity index 76% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_msql_index_constraint_with_index.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_constraint_with_index_msql.sql index 7031f24f9..a309837aa 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/11_plus/alter_msql_index_constraint_with_index.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_constraint_with_index_msql.sql @@ -1,6 +1,6 @@ -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons RENAME CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" TO "Pk_$%{}[]()&*^!@""'`\/#a"; ALTER INDEX testschema."Pk_$%{}[]()&*^!@""'`\/#a" SET (FILLFACTOR=90); -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_primary_key_cons IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_reset_fillfactor.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_reset_fillfactor.sql similarity index 58% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_reset_fillfactor.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_reset_fillfactor.sql index 0cef7267f..d7d3a8b17 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_reset_fillfactor.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_reset_fillfactor.sql @@ -1,11 +1,11 @@ -- Constraint: Pk_$%{}[]()&*^!@"'`\/#a --- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a"; +-- ALTER TABLE testschema.tablefor_primary_key_cons DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a"; -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" PRIMARY KEY (col1) DEFERRABLE INITIALLY DEFERRED; -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_primary_key_cons IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_msql_reset_fillfactor.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_reset_fillfactor_msql.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_msql_reset_fillfactor.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_pkey_reset_fillfactor_msql.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint.sql new file mode 100644 index 000000000..6ea597796 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint.sql @@ -0,0 +1,11 @@ +-- Constraint: UC_$%{}[]()&*^!@"'`\/#a + +-- ALTER TABLE testschema.tablefor_unique_cons DROP CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a"; + +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" UNIQUE (col1) + WITH (FILLFACTOR=90) + DEFERRABLE INITIALLY DEFERRED; + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_unique_cons + IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint_msql.sql new file mode 100644 index 000000000..7d1f9e45a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint_msql.sql @@ -0,0 +1,6 @@ +ALTER TABLE testschema.tablefor_unique_cons + RENAME CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" TO "UC_$%{}[]()&*^!@""'`\/#a"; +ALTER INDEX testschema."UC_$%{}[]()&*^!@""'`\/#a" + SET (FILLFACTOR=90); +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_unique_cons + IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint_with_index.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint_with_index.sql new file mode 100644 index 000000000..523703f73 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint_with_index.sql @@ -0,0 +1,11 @@ +-- Constraint: UC_$%{}[]()&*^!@"'`\/#a + +-- ALTER TABLE testschema.tablefor_unique_cons DROP CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a"; + +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" UNIQUE (col1) + WITH (FILLFACTOR=90); + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_unique_cons + IS 'Comment for alter'; + diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint_with_index_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint_with_index_msql.sql new file mode 100644 index 000000000..7d1f9e45a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_constraint_with_index_msql.sql @@ -0,0 +1,6 @@ +ALTER TABLE testschema.tablefor_unique_cons + RENAME CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" TO "UC_$%{}[]()&*^!@""'`\/#a"; +ALTER INDEX testschema."UC_$%{}[]()&*^!@""'`\/#a" + SET (FILLFACTOR=90); +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_unique_cons + IS 'Comment for alter'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_reset_fillfactor.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_reset_fillfactor.sql new file mode 100644 index 000000000..47cd0bc3f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_reset_fillfactor.sql @@ -0,0 +1,11 @@ +-- Constraint: UC_$%{}[]()&*^!@"'`\/#a + +-- ALTER TABLE testschema.tablefor_unique_cons DROP CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a"; + +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" UNIQUE (col1) + DEFERRABLE INITIALLY DEFERRED; + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#a" ON testschema.tablefor_unique_cons + IS 'Comment for alter'; + diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_reset_fillfactor_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_reset_fillfactor_msql.sql new file mode 100644 index 000000000..4560538d4 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/alter_unique_reset_fillfactor_msql.sql @@ -0,0 +1,2 @@ +ALTER INDEX testschema."UC_$%{}[]()&*^!@""'`\/#a" + RESET (FILLFACTOR); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_msql_index_constraint_with_index.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_msql_index_constraint_with_index.sql deleted file mode 100644 index e1e943668..000000000 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_msql_index_constraint_with_index.sql +++ /dev/null @@ -1,6 +0,0 @@ -ALTER TABLE testschema.tableforindexcon - ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1) - WITH (FILLFACTOR=20); - -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon - IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_index_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_pkey_constraint.sql similarity index 60% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_index_constraint.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_pkey_constraint.sql index 42a9f8004..2f2c493e1 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_index_constraint.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_pkey_constraint.sql @@ -1,11 +1,11 @@ -- Constraint: Pk_$%{}[]()&*^!@"'`\/# --- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#"; +-- ALTER TABLE testschema.tablefor_primary_key_cons DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#"; -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1) WITH (FILLFACTOR=20) DEFERRABLE INITIALLY DEFERRED; -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_primary_key_cons IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_msql_index_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_pkey_constraint_msql.sql similarity index 74% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_msql_index_constraint.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_pkey_constraint_msql.sql index aac679e6e..6f65d212a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_msql_index_constraint.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_pkey_constraint_msql.sql @@ -1,7 +1,7 @@ -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1) WITH (FILLFACTOR=20) DEFERRABLE INITIALLY DEFERRED; -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_primary_key_cons IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_index_constraint_with_index.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_pkey_constraint_with_index.sql similarity index 57% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_index_constraint_with_index.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_pkey_constraint_with_index.sql index 70aa78d4b..c6da21c48 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_index_constraint_with_index.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_pkey_constraint_with_index.sql @@ -1,10 +1,10 @@ -- Constraint: Pk_$%{}[]()&*^!@"'`\/# --- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#"; +-- ALTER TABLE testschema.tablefor_primary_key_cons DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#"; -ALTER TABLE testschema.tableforindexcon +ALTER TABLE testschema.tablefor_primary_key_cons ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1) WITH (FILLFACTOR=20); -COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_primary_key_cons IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_pkey_constraint_with_index_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_pkey_constraint_with_index_msql.sql new file mode 100644 index 000000000..bdbb820cf --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_pkey_constraint_with_index_msql.sql @@ -0,0 +1,5 @@ +ALTER TABLE testschema.tablefor_primary_key_cons + ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY USING INDEX uindex; + +COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_primary_key_cons + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint.sql new file mode 100644 index 000000000..c720c2108 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint.sql @@ -0,0 +1,11 @@ +-- Constraint: UC_$%{}[]()&*^!@"'`\/# + +-- ALTER TABLE testschema.tablefor_unique_cons DROP CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" UNIQUE (col1) + WITH (FILLFACTOR=20) + DEFERRABLE INITIALLY DEFERRED; + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_unique_cons + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint_msql.sql new file mode 100644 index 000000000..fb47fd94d --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint_msql.sql @@ -0,0 +1,7 @@ +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" UNIQUE (col1) + WITH (FILLFACTOR=20) + DEFERRABLE INITIALLY DEFERRED; + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_unique_cons + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint_with_index.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint_with_index.sql new file mode 100644 index 000000000..83c3e289e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint_with_index.sql @@ -0,0 +1,10 @@ +-- Constraint: UC_$%{}[]()&*^!@"'`\/# + +-- ALTER TABLE testschema.tablefor_unique_cons DROP CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" UNIQUE (col1) + WITH (FILLFACTOR=20); + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_unique_cons + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint_with_index_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint_with_index_msql.sql new file mode 100644 index 000000000..bb1f7c650 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/create_unique_constraint_with_index_msql.sql @@ -0,0 +1,5 @@ +ALTER TABLE testschema.tablefor_unique_cons + ADD CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" UNIQUE USING INDEX uindex; + +COMMENT ON CONSTRAINT "UC_$%{}[]()&*^!@""'`\/#" ON testschema.tablefor_unique_cons + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/test_primary_key.json similarity index 79% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/test.json rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/test_primary_key.json index ea2dbce1c..5e3edee5c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/test_primary_key.json @@ -6,7 +6,7 @@ "endpoint": "NODE-table.obj", "sql_endpoint": "NODE-table.sql_id", "data": { - "name": "tableforindexcon", + "name": "tablefor_primary_key_cons", "columns": [{ "name": "col1", "cltype": "integer", @@ -40,6 +40,7 @@ "name": "Create Primary Key Constraint", "endpoint": "NODE-primary_key.obj", "sql_endpoint": "NODE-primary_key.sql_id", + "msql_endpoint": "NODE-primary_key.msql", "data": { "name": "Pk_$%{}[]()&*^!@\"'`\\/#", "comment": "Comment for create", @@ -48,8 +49,8 @@ "condeferrable": true, "condeferred": true }, - "expected_sql_file": "create_index_constraint.sql", - "expected_msql_file": "create_msql_index_constraint.sql" + "expected_sql_file": "create_pkey_constraint.sql", + "expected_msql_file": "create_pkey_constraint_msql.sql" }, { "type": "alter", "name": "Alter Primary Key Constraint", @@ -61,8 +62,8 @@ "fillfactor": 90, "comment": "Comment for alter" }, - "expected_sql_file": "alter_index_constraint.sql", - "expected_msql_file": "alter_msql_index_constraint.sql" + "expected_sql_file": "alter_pkey_constraint.sql", + "expected_msql_file": "alter_pkey_constraint_msql.sql" }, { "type": "alter", "name": "Alter Primary Key Constraint Reset Fill factor", @@ -72,8 +73,8 @@ "data": { "fillfactor": "" }, - "expected_sql_file": "alter_reset_fillfactor.sql", - "expected_msql_file": "alter_msql_reset_fillfactor.sql" + "expected_sql_file": "alter_pkey_reset_fillfactor.sql", + "expected_msql_file": "alter_pkey_reset_fillfactor_msql.sql" }, { "type": "delete", "name": "Drop Primary Key Constraint", @@ -86,12 +87,14 @@ "name": "Create Primary Key Constraint with Index", "endpoint": "NODE-primary_key.obj", "sql_endpoint": "NODE-primary_key.sql_id", + "msql_endpoint": "NODE-primary_key.msql", "data": { "name": "Pk_$%{}[]()&*^!@\"'`\\/#", "comment": "Comment for create", "index": "uindex" }, - "expected_sql_file": "create_index_constraint_with_index.sql" + "expected_sql_file": "create_pkey_constraint_with_index.sql", + "expected_msql_file": "create_pkey_constraint_with_index_msql.sql" }, { "type": "alter", "name": "Alter Primary Key Constraint with Index", @@ -103,8 +106,8 @@ "fillfactor": 90, "comment": "Comment for alter" }, - "expected_sql_file": "alter_index_constraint_with_index.sql", - "expected_msql_file": "alter_msql_index_constraint_with_index.sql" + "expected_sql_file": "alter_pkey_constraint_with_index.sql", + "expected_msql_file": "alter_pkey_constraint_with_index_msql.sql" }, { "type": "delete", "name": "Drop Primary Key Constraint with Index", @@ -117,7 +120,7 @@ "name": "Drop Index Constraint Table", "endpoint": "NODE-table.delete_id", "data": { - "name": "tableforindexcon" + "name": "tablefor_primary_key_cons" } } ] diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/test_unique_constraint.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/test_unique_constraint.json new file mode 100644 index 000000000..9eb8d356e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/tests/default/test_unique_constraint.json @@ -0,0 +1,127 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "tablefor_unique_cons", + "columns": [{ + "name": "col1", + "cltype": "integer", + "is_primary_key": false + }], + "is_partitioned": false, + "schema": "testschema", + "spcname": "pg_default" + }, + "store_object_id": true + }, { + "type": "create", + "name": "Create Index", + "endpoint": "NODE-index.obj", + "sql_endpoint": "NODE-index.sql_id", + "data": { + "name": "uindex", + "spcname": "pg_default", + "amname": "btree", + "columns": [{ + "colname": "col1", + "sort_order": false, + "nulls": false, + "is_sort_nulls_applicable": true + }], + "indisunique": true, + "fillfactor": 20 + } + }, { + "type": "create", + "name": "Create Unique Constraint", + "endpoint": "NODE-unique_constraint.obj", + "sql_endpoint": "NODE-unique_constraint.sql_id", + "msql_endpoint": "NODE-unique_constraint.msql", + "data": { + "name": "UC_$%{}[]()&*^!@\"'`\\/#", + "comment": "Comment for create", + "fillfactor": 20, + "columns": [{"column":"col1"}], + "condeferrable": true, + "condeferred": true + }, + "expected_sql_file": "create_unique_constraint.sql", + "expected_msql_file": "create_unique_constraint_msql.sql" + }, { + "type": "alter", + "name": "Alter Unique Constraint", + "endpoint": "NODE-unique_constraint.obj_id", + "sql_endpoint": "NODE-unique_constraint.sql_id", + "msql_endpoint": "NODE-unique_constraint.msql_id", + "data": { + "name": "UC_$%{}[]()&*^!@\"'`\\/#a", + "fillfactor": 90, + "comment": "Comment for alter" + }, + "expected_sql_file": "alter_unique_constraint.sql", + "expected_msql_file": "alter_unique_constraint_msql.sql" + }, { + "type": "alter", + "name": "Alter Unique Constraint Reset Fill factor", + "endpoint": "NODE-unique_constraint.obj_id", + "sql_endpoint": "NODE-unique_constraint.sql_id", + "msql_endpoint": "NODE-unique_constraint.msql_id", + "data": { + "fillfactor": "" + }, + "expected_sql_file": "alter_unique_reset_fillfactor.sql", + "expected_msql_file": "alter_unique_reset_fillfactor_msql.sql" + }, { + "type": "delete", + "name": "Drop Unique Constraint", + "endpoint": "NODE-unique_constraint.delete_id", + "data": { + "name": "UC_$%{}[]()&*^!@\"'`\\/#a" + } + }, { + "type": "create", + "name": "Create Unique Constraint with Index", + "endpoint": "NODE-unique_constraint.obj", + "sql_endpoint": "NODE-unique_constraint.sql_id", + "msql_endpoint": "NODE-unique_constraint.msql", + "data": { + "name": "UC_$%{}[]()&*^!@\"'`\\/#", + "comment": "Comment for create", + "index": "uindex" + }, + "expected_sql_file": "create_unique_constraint_with_index.sql", + "expected_msql_file": "create_unique_constraint_with_index_msql.sql" + }, { + "type": "alter", + "name": "Alter Unique Constraint with Index", + "endpoint": "NODE-unique_constraint.obj_id", + "sql_endpoint": "NODE-unique_constraint.sql_id", + "msql_endpoint": "NODE-unique_constraint.msql_id", + "data": { + "name": "UC_$%{}[]()&*^!@\"'`\\/#a", + "fillfactor": 90, + "comment": "Comment for alter" + }, + "expected_sql_file": "alter_unique_constraint_with_index.sql", + "expected_msql_file": "alter_unique_constraint_with_index_msql.sql" + }, { + "type": "delete", + "name": "Drop Unique Constraint", + "endpoint": "NODE-unique_constraint.delete_id", + "data": { + "name": "UC_$%{}[]()&*^!@\"'`\\/#a" + } + }, { + "type": "delete", + "name": "Drop Unique Constraint Table", + "endpoint": "NODE-table.delete_id", + "data": { + "name": "tablefor_unique_cons" + } + } + ] +}