CREATE SCHEMA alter_role; CREATE SCHEMA ",CitUs,.TeeN!?"; -- test if the passowrd of the extension owner can be upgraded ALTER ROLE CURRENT_USER PASSWORD 'password123' VALID UNTIL 'infinity'; SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,"(postgres,t,t,t,t,t,t,t,-1,md5891d7d5079424b1cb973187d354d78de,Infinity)") (localhost,57638,t,"(postgres,t,t,t,t,t,t,t,-1,md5891d7d5079424b1cb973187d354d78de,Infinity)") (2 rows) -- test if the password and some connection settings are propagated when a node gets added ALTER ROLE CURRENT_USER WITH CONNECTION LIMIT 66 VALID UNTIL '2032-05-05' PASSWORD 'password456'; SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = 'alter_role_1'; row --------------------------------------------------------------------- (0 rows) SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,"(postgres,t,t,t,t,t,t,t,66,md568701dc40be546e0357027fb0109338c,2032)") (localhost,57638,t,"(postgres,t,t,t,t,t,t,t,66,md568701dc40be546e0357027fb0109338c,2032)") (2 rows) SELECT master_remove_node('localhost', :worker_1_port); master_remove_node --------------------------------------------------------------------- (1 row) ALTER ROLE CURRENT_USER WITH CONNECTION LIMIT 0 VALID UNTIL '2052-05-05' PASSWORD 'password789'; SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = 'alter_role_1'; row --------------------------------------------------------------------- (0 rows) SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); run_command_on_workers --------------------------------------------------------------------- (localhost,57638,t,"(postgres,t,t,t,t,t,t,t,0,md53e559cc1fcf0c70f1f8e05c9a79c3133,2052)") (1 row) SELECT 1 FROM master_add_node('localhost', :worker_1_port); ?column? --------------------------------------------------------------------- 1 (1 row) SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = 'alter_role_1'; row --------------------------------------------------------------------- (0 rows) SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,"(postgres,t,t,t,t,t,t,t,0,md53e559cc1fcf0c70f1f8e05c9a79c3133,2052)") (localhost,57638,t,"(postgres,t,t,t,t,t,t,t,0,md53e559cc1fcf0c70f1f8e05c9a79c3133,2052)") (2 rows) -- check user, database and postgres wide SET settings. -- pre check SELECT run_command_on_workers('SHOW enable_hashjoin'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,on) (localhost,57638,t,on) (2 rows) SELECT run_command_on_workers('SHOW enable_indexonlyscan'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,on) (localhost,57638,t,on) (2 rows) SELECT run_command_on_workers('SHOW enable_hashagg'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,on) (localhost,57638,t,on) (2 rows) -- remove 1 node to verify settings are copied when the node gets added back SELECT master_remove_node('localhost', :worker_1_port); master_remove_node --------------------------------------------------------------------- (1 row) -- change a setting for all users ALTER ROLE ALL SET enable_hashjoin TO FALSE; SELECT run_command_on_workers('SHOW enable_hashjoin'); run_command_on_workers --------------------------------------------------------------------- (localhost,57638,t,off) (1 row) ALTER ROLE ALL IN DATABASE regression SET enable_indexonlyscan TO FALSE; SELECT run_command_on_workers('SHOW enable_indexonlyscan'); run_command_on_workers --------------------------------------------------------------------- (localhost,57638,t,off) (1 row) -- alter configuration_parameter defaults for a user ALTER ROLE CURRENT_USER SET enable_hashagg TO FALSE; SELECT run_command_on_workers('SHOW enable_hashagg'); run_command_on_workers --------------------------------------------------------------------- (localhost,57638,t,off) (1 row) -- provide a list of values in a supported configuration ALTER ROLE CURRENT_USER SET search_path TO ",CitUs,.TeeN!?", alter_role, public; -- test user defined GUCs that appear to be a list, but instead a single string ALTER ROLE ALL SET public.myguc TO "Hello, World"; -- test for configuration values that should not be downcased even when unquoted ALTER ROLE CURRENT_USER SET lc_messages TO 'C'; -- add worker and check all settings are copied SELECT 1 FROM master_add_node('localhost', :worker_1_port); ?column? --------------------------------------------------------------------- 1 (1 row) SELECT run_command_on_workers('SHOW enable_hashjoin'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,off) (localhost,57638,t,off) (2 rows) SELECT run_command_on_workers('SHOW enable_indexonlyscan'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,off) (localhost,57638,t,off) (2 rows) SELECT run_command_on_workers('SHOW enable_hashagg'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,off) (localhost,57638,t,off) (2 rows) SELECT run_command_on_workers('SHOW search_path'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,""",CitUs,.TeeN!?"", alter_role, public") (localhost,57638,t,""",CitUs,.TeeN!?"", alter_role, public") (2 rows) SELECT run_command_on_workers('SHOW lc_messages'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,C) (localhost,57638,t,C) (2 rows) SELECT run_command_on_workers('SHOW public.myguc'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,"Hello, World") (localhost,57638,t,"Hello, World") (2 rows) -- reset to default values ALTER ROLE CURRENT_USER RESET enable_hashagg; SELECT run_command_on_workers('SHOW enable_hashagg'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,on) (localhost,57638,t,on) (2 rows) -- RESET ALL with IN DATABASE clause ALTER ROLE ALL RESET ALL; -- post check 1 - should have settings reset except for database specific settings SELECT run_command_on_workers('SHOW enable_hashjoin'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,on) (localhost,57638,t,on) (2 rows) SELECT run_command_on_workers('SHOW enable_indexonlyscan'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,off) (localhost,57638,t,off) (2 rows) SELECT run_command_on_workers('SHOW enable_hashagg'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,on) (localhost,57638,t,on) (2 rows) ALTER ROLE ALL IN DATABASE regression RESET ALL; -- post check 2 - should have all settings reset SELECT run_command_on_workers('SHOW enable_hashjoin'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,on) (localhost,57638,t,on) (2 rows) SELECT run_command_on_workers('SHOW enable_indexonlyscan'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,on) (localhost,57638,t,on) (2 rows) SELECT run_command_on_workers('SHOW enable_hashagg'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,on) (localhost,57638,t,on) (2 rows) -- make sure alter role set is not propagated when the feature is deliberately turned off SET citus.enable_alter_role_set_propagation TO off; -- remove 1 node to verify settings are NOT copied when the node gets added back SELECT master_remove_node('localhost', :worker_1_port); master_remove_node --------------------------------------------------------------------- (1 row) ALTER ROLE ALL SET enable_hashjoin TO FALSE; SELECT 1 FROM master_add_node('localhost', :worker_1_port); ?column? --------------------------------------------------------------------- 1 (1 row) SELECT run_command_on_workers('SHOW enable_hashjoin'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,on) (localhost,57638,t,on) (2 rows) ALTER ROLE ALL RESET enable_hashjoin; SELECT run_command_on_workers('SHOW enable_hashjoin'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,on) (localhost,57638,t,on) (2 rows) DROP SCHEMA alter_role, ",CitUs,.TeeN!?" CASCADE;