\set create_drop_db_tablespace :abs_srcdir '/tmp_check/ts3' CREATE TABLESPACE create_drop_db_tablespace LOCATION :'create_drop_db_tablespace'; \c - - - :worker_1_port \set create_drop_db_tablespace :abs_srcdir '/tmp_check/ts4' CREATE TABLESPACE create_drop_db_tablespace LOCATION :'create_drop_db_tablespace'; \c - - - :worker_2_port \set create_drop_db_tablespace :abs_srcdir '/tmp_check/ts5' CREATE TABLESPACE create_drop_db_tablespace LOCATION :'create_drop_db_tablespace'; \c - - - :master_port create user create_drop_db_test_user; set citus.enable_create_database_propagation=on; CREATE DATABASE mydatabase WITH TEMPLATE = 'template0' OWNER = create_drop_db_test_user CONNECTION LIMIT = 10 ENCODING = 'UTF8' LC_COLLATE = 'C' LC_CTYPE = 'C' TABLESPACE = create_drop_db_tablespace ALLOW_CONNECTIONS = true IS_TEMPLATE = false; SELECT pd.datname, pd.encoding, pd.datistemplate, pd.datallowconn, pd.datconnlimit, pd.datcollate , pd. datctype , pd.datacl, pa.rolname AS database_owner, pt.spcname AS tablespace FROM pg_database pd JOIN pg_authid pa ON pd.datdba = pa.oid join pg_tablespace pt on pd.dattablespace = pt.oid WHERE datname = 'mydatabase'; datname | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | tablespace --------------------------------------------------------------------- mydatabase | 6 | f | t | 10 | C | C | | create_drop_db_test_user | create_drop_db_tablespace (1 row) \c - - - :worker_1_port SELECT pd.datname, pd.encoding, pd.datistemplate, pd.datallowconn, pd.datconnlimit, pd.datcollate , pd. datctype , pd.datacl, rolname AS database_owner, pa.rolname AS database_owner, pt.spcname AS tablespace FROM pg_database pd JOIN pg_authid pa ON pd.datdba = pa.oid join pg_tablespace pt on pd.dattablespace = pt.oid WHERE datname = 'mydatabase'; datname | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace --------------------------------------------------------------------- mydatabase | 6 | f | t | 10 | C | C | | create_drop_db_test_user | create_drop_db_test_user | create_drop_db_tablespace (1 row) \c - - - :worker_2_port SELECT pd.datname, pd.encoding, pd.datistemplate, pd.datallowconn, pd.datconnlimit, pd.datcollate , pd. datctype , pd.datacl, rolname AS database_owner, pa.rolname AS database_owner, pt.spcname AS tablespace FROM pg_database pd JOIN pg_authid pa ON pd.datdba = pa.oid join pg_tablespace pt on pd.dattablespace = pt.oid WHERE datname = 'mydatabase'; datname | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace --------------------------------------------------------------------- mydatabase | 6 | f | t | 10 | C | C | | create_drop_db_test_user | create_drop_db_test_user | create_drop_db_tablespace (1 row) \c - - - :master_port set citus.enable_create_database_propagation=on; drop database mydatabase; SELECT pd.datname, pd.encoding, pd.datistemplate, pd.datallowconn, pd.datconnlimit, pd.datcollate , pd. datctype , pd.datacl, rolname AS database_owner, pa.rolname AS database_owner, pt.spcname AS tablespace FROM pg_database pd JOIN pg_authid pa ON pd.datdba = pa.oid join pg_tablespace pt on pd.dattablespace = pt.oid WHERE datname = 'mydatabase'; datname | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace --------------------------------------------------------------------- (0 rows) \c - - - :worker_1_port SELECT pd.datname, pd.encoding, pd.datistemplate, pd.datallowconn, pd.datconnlimit, pd.datcollate , pd. datctype , pd.datacl, rolname AS database_owner, pa.rolname AS database_owner, pt.spcname AS tablespace FROM pg_database pd JOIN pg_authid pa ON pd.datdba = pa.oid join pg_tablespace pt on pd.dattablespace = pt.oid WHERE datname = 'mydatabase'; datname | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace --------------------------------------------------------------------- (0 rows) \c - - - :worker_2_port SELECT pd.datname, pd.encoding, pd.datistemplate, pd.datallowconn, pd.datconnlimit, pd.datcollate , pd. datctype , pd.datacl, rolname AS database_owner, pa.rolname AS database_owner, pt.spcname AS tablespace FROM pg_database pd JOIN pg_authid pa ON pd.datdba = pa.oid join pg_tablespace pt on pd.dattablespace = pt.oid WHERE datname = 'mydatabase'; datname | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace --------------------------------------------------------------------- (0 rows) \c - - - :master_port --tests for special characters in database name set citus.enable_create_database_propagation=on; SET citus.log_remote_commands = true; set citus.grep_remote_commands = '%CREATE DATABASE%'; create database "mydatabase#1'2"; NOTICE: issuing CREATE DATABASE "mydatabase#1'2" DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx NOTICE: issuing CREATE DATABASE "mydatabase#1'2" DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx set citus.grep_remote_commands = '%DROP DATABASE%'; drop database if exists "mydatabase#1'2"; NOTICE: issuing DROP DATABASE IF EXISTS "mydatabase#1'2" DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx NOTICE: issuing DROP DATABASE IF EXISTS "mydatabase#1'2" DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx --clean up resources created by this test drop tablespace create_drop_db_tablespace; \c - - - :worker_1_port drop tablespace create_drop_db_tablespace; \c - - - :worker_2_port drop tablespace create_drop_db_tablespace; \c - - - :master_port drop user create_drop_db_test_user;