diff --git a/src/test/regress/expected/collate.out b/src/test/regress/expected/collate.out index 91d574d..e92626b 100644 --- a/src/test/regress/expected/collate.out +++ b/src/test/regress/expected/collate.out @@ -626,6 +626,74 @@ SELECT collation for ((SELECT b FROM collate_test1 LIMIT 1)); "C" (1 row) +-- CREATE COLLATE tests +CREATE COLLATION collate_coll2 FROM "C"; +-- Ensure non-OWNER ROLEs are not able to ALTER/DROP COLLATION +CREATE ROLE role_collate1; +SET ROLE role_collate1; +DROP COLLATION IF EXISTS collate_coll2; +NOTICE: collation "collate_coll2" does not exist, skipping +-- Currently no way to test this without ensuring that this test works on +-- all kinds of systems (even without UTF8 encoding DBs) +-- ALTER COLLATION collate_coll2 OWNER TO role_collate1; +RESET ROLE; +-- Ensure ALTER COLLATION SET SCHEMA works as expected +CREATE SCHEMA collate_tests2; +ALTER COLLATION collate_coll2 SET SCHEMA collate_tests2; +DROP COLLATION collate_tests2.collate_coll2; +DROP SCHEMA collate_tests2; +-- Should work. Classic cases of CREATE/ALTER COLLATION +CREATE COLLATION collate_coll3 (LOCALE = 'C'); +ALTER COLLATION collate_coll3 OWNER TO role_collate1; +ALTER COLLATION collate_coll3 RENAME TO collate_coll33; +DROP COLLATION collate_coll33; +DROP ROLE role_collate1; +-- Should fail. Give redundant options +CREATE COLLATION collate_coll3a (LOCALE = 'C', LC_COLLATE = 'C', LC_CTYPE= 'C'); +ERROR: conflicting or redundant options +-- Should fail. LC_COLLATE must be specified +CREATE COLLATION collate_coll5 (LC_CTYPE= 'C'); +ERROR: parameter "lc_collate" must be specified +-- Should fail. Give value options without value +CREATE COLLATION collate_coll4a (LC_COLLATE = ''); +ERROR: parameter "lc_ctype" must be specified +CREATE COLLATION collate_coll5a (LC_CTYPE= ''); +ERROR: parameter "lc_collate" must be specified +-- Should fail. Give invalid option name +CREATE COLLATION collate_coll6 (ASDF = 'C'); +ERROR: collation attribute "asdf" not recognized +-- Ensure error is displayed when a collation is RENAMEd but that named collation already exists +-- Currently no way to test this without ensuring that this test works on +-- all kinds of systems (even without UTF8 encoding DBs) +-- CREATE COLLATION collate_coll7 (LOCALE = 'C'); +-- CREATE COLLATION collate_coll7a (LOCALE = 'C'); +-- ALTER COLLATION collate_coll7a RENAME TO collate_coll7; +-- DROP COLLATION collate_coll7; +-- DROP COLLATION collate_coll7a; +-- Ensure error is displayed during ALTER COLLATION SET SCHEMA when +-- the target SCHEMA already contains COLLATION of same name +-- Currently no way to test this without ensuring that this test works on +-- all kinds of systems (even without UTF8 encoding DBs) +-- CREATE COLLATION collate_coll8 (LOCALE = 'C'); +-- CREATE SCHEMA collate_tests3; +-- CREATE COLLATION collate_tests3.collate_coll8 (LOCALE = 'C'); +-- ALTER COLLATION collate_coll8 SET SCHEMA collate_tests3; +-- DROP SCHEMA collate_tests3 CASCADE; +-- DROP COLLATION collate_coll8; +-- Ensure ROLEs without USAGE access shouldn't be able to CREATE/ALTER COLLATION +CREATE SCHEMA collate_tests4; +CREATE COLLATION collate_tests4.collate_coll9 (LOCALE = 'C'); +CREATE ROLE role_collate2; +REVOKE USAGE ON SCHEMA collate_tests4 FROM role_collate2; +SET ROLE role_collate2; +ALTER COLLATION collate_tests4.collate_coll9 RENAME TO collate_coll9b; +ERROR: permission denied for schema collate_tests4 +CREATE COLLATION collate_tests4.collate_coll10 (LOCALE = 'C'); +ERROR: permission denied for schema collate_tests4 +RESET ROLE; +DROP ROLE role_collate2; +DROP SCHEMA collate_tests4 CASCADE; +NOTICE: drop cascades to collation collate_coll9 -- -- Clean up. Many of these table names will be re-used if the user is -- trying to run any platform-specific collation tests later, so we diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule index 2af28b1..7360f8b 100644 --- a/src/test/regress/parallel_schedule +++ b/src/test/regress/parallel_schedule @@ -59,7 +59,7 @@ test: create_index create_view # ---------- # Another group of parallel tests # ---------- -test: create_aggregate create_function_3 create_cast constraints triggers inherit create_table_like typed_table vacuum drop_if_exists updatable_views +test: create_aggregate create_function_3 create_cast constraints triggers inherit create_table_like typed_table vacuum drop_if_exists updatable_views user # ---------- # sanity_check does a vacuum, affecting the sort order of SELECT * diff --git a/src/test/regress/sql/collate.sql b/src/test/regress/sql/collate.sql index 63ab590..0f47477 100644 --- a/src/test/regress/sql/collate.sql +++ b/src/test/regress/sql/collate.sql @@ -231,6 +231,75 @@ SELECT collation for ('foo'::text); SELECT collation for ((SELECT a FROM collate_test1 LIMIT 1)); -- non-collatable type - error SELECT collation for ((SELECT b FROM collate_test1 LIMIT 1)); +-- CREATE COLLATE tests +CREATE COLLATION collate_coll2 FROM "C"; + +-- Ensure non-OWNER ROLEs are not able to ALTER/DROP COLLATION +CREATE ROLE role_collate1; +SET ROLE role_collate1; +DROP COLLATION IF EXISTS collate_coll2; +-- Currently no way to test this without ensuring that this test works on +-- all kinds of systems (even without UTF8 encoding DBs) +-- ALTER COLLATION collate_coll2 OWNER TO role_collate1; +RESET ROLE; + +-- Ensure ALTER COLLATION SET SCHEMA works as expected +CREATE SCHEMA collate_tests2; +ALTER COLLATION collate_coll2 SET SCHEMA collate_tests2; +DROP COLLATION collate_tests2.collate_coll2; +DROP SCHEMA collate_tests2; + +-- Should work. Classic cases of CREATE/ALTER COLLATION +CREATE COLLATION collate_coll3 (LOCALE = 'C'); +ALTER COLLATION collate_coll3 OWNER TO role_collate1; +ALTER COLLATION collate_coll3 RENAME TO collate_coll33; +DROP COLLATION collate_coll33; +DROP ROLE role_collate1; + +-- Should fail. Give redundant options +CREATE COLLATION collate_coll3a (LOCALE = 'C', LC_COLLATE = 'C', LC_CTYPE= 'C'); + +-- Should fail. LC_COLLATE must be specified +CREATE COLLATION collate_coll5 (LC_CTYPE= 'C'); + +-- Should fail. Give value options without value +CREATE COLLATION collate_coll4a (LC_COLLATE = ''); +CREATE COLLATION collate_coll5a (LC_CTYPE= ''); + +-- Should fail. Give invalid option name +CREATE COLLATION collate_coll6 (ASDF = 'C'); + +-- Ensure error is displayed when a collation is RENAMEd but that named collation already exists +-- Currently no way to test this without ensuring that this test works on +-- all kinds of systems (even without UTF8 encoding DBs) +-- CREATE COLLATION collate_coll7 (LOCALE = 'C'); +-- CREATE COLLATION collate_coll7a (LOCALE = 'C'); +-- ALTER COLLATION collate_coll7a RENAME TO collate_coll7; +-- DROP COLLATION collate_coll7; +-- DROP COLLATION collate_coll7a; + +-- Ensure error is displayed during ALTER COLLATION SET SCHEMA when +-- the target SCHEMA already contains COLLATION of same name +-- Currently no way to test this without ensuring that this test works on +-- all kinds of systems (even without UTF8 encoding DBs) +-- CREATE COLLATION collate_coll8 (LOCALE = 'C'); +-- CREATE SCHEMA collate_tests3; +-- CREATE COLLATION collate_tests3.collate_coll8 (LOCALE = 'C'); +-- ALTER COLLATION collate_coll8 SET SCHEMA collate_tests3; +-- DROP SCHEMA collate_tests3 CASCADE; +-- DROP COLLATION collate_coll8; + +-- Ensure ROLEs without USAGE access shouldn't be able to CREATE/ALTER COLLATION +CREATE SCHEMA collate_tests4; +CREATE COLLATION collate_tests4.collate_coll9 (LOCALE = 'C'); +CREATE ROLE role_collate2; +REVOKE USAGE ON SCHEMA collate_tests4 FROM role_collate2; +SET ROLE role_collate2; +ALTER COLLATION collate_tests4.collate_coll9 RENAME TO collate_coll9b; +CREATE COLLATION collate_tests4.collate_coll10 (LOCALE = 'C'); +RESET ROLE; +DROP ROLE role_collate2; +DROP SCHEMA collate_tests4 CASCADE; -- -- Clean up. Many of these table names will be re-used if the user is