diff --git a/src/test/regress/expected/create_drop_database_propagation.out b/src/test/regress/expected/create_drop_database_propagation.out index 5b835567e..98155024c 100644 --- a/src/test/regress/expected/create_drop_database_propagation.out +++ b/src/test/regress/expected/create_drop_database_propagation.out @@ -1,46 +1,111 @@ -set citus.enable_create_database_propagation=on; +\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' - STRATEGY = 'wal_log' - LOCALE = 'C' LC_COLLATE = 'C' LC_CTYPE = 'C' - ICU_LOCALE = 'C' - LOCALE_PROVIDER = 'icu' - COLLATION_VERSION = '1.0' TABLESPACE = test_tablespace ALLOW_CONNECTIONS = true - IS_TEMPLATE = false - OID = 966345; -SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, + IS_TEMPLATE = false; +SELECT pd.datname , pd.datdba, pd.encoding, pd.datistemplate, pd.datallowconn, pd.datconnlimit, -pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, -pd.datacl, rolname AS database_owner, pa.rolname AS database_owner, pt.spcname AS tablespace +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 | datdba | encoding | datlocprovider | datistemplate | datallowconn | datconnlimit | datcollate | datctype | daticulocale | datcollversion | datacl | database_owner | database_owner | tablespace + datname | datdba | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace --------------------------------------------------------------------- - mydatabase | 17343 | 6 | i | f | t | 10 | C | C | C | 1.0 | | create_drop_db_test_user | create_drop_db_test_user | test_tablespace + mydatabase | 17344 | 6 | f | t | 10 | C | C | | create_drop_db_test_user | create_drop_db_test_user | test_tablespace (1 row) -drop database mydatabase; -SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +\c - - - :worker_1_port +SELECT pd.datname , pd.datdba, pd.encoding, pd.datistemplate, pd.datallowconn, pd.datconnlimit, -pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, -pd.datacl, rolname AS database_owner, pa.rolname AS database_owner, pt.spcname AS tablespace +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 | datdba | encoding | datlocprovider | datistemplate | datallowconn | datconnlimit | datcollate | datctype | daticulocale | datcollversion | datacl | database_owner | database_owner | tablespace + datname | datdba | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace +--------------------------------------------------------------------- + mydatabase | 17404 | 6 | f | t | 10 | C | C | | create_drop_db_test_user | create_drop_db_test_user | test_tablespace +(1 row) + +\c - - - :worker_2_port +SELECT pd.datname , pd.datdba, 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 | datdba | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace +--------------------------------------------------------------------- + mydatabase | 17404 | 6 | f | t | 10 | C | C | | create_drop_db_test_user | create_drop_db_test_user | test_tablespace +(1 row) + +\c - - - :master_port +set citus.enable_create_database_propagation=on; +drop database mydatabase; +SELECT pd.datname , pd.datdba, 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 | datdba | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace --------------------------------------------------------------------- (0 rows) +\c - - - :worker_1_port +SELECT pd.datname , pd.datdba, 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 | datdba | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace +--------------------------------------------------------------------- +(0 rows) + +\c - - - :worker_2_port +SELECT pd.datname , pd.datdba, 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 | datdba | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace +--------------------------------------------------------------------- +(0 rows) + +\c - - - :master_port +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; -set citus.enable_create_database_propagation=off; diff --git a/src/test/regress/expected/pg15.out b/src/test/regress/expected/pg15.out index fcbb0cd12..2f005070a 100644 --- a/src/test/regress/expected/pg15.out +++ b/src/test/regress/expected/pg15.out @@ -586,59 +586,19 @@ WHERE f.numeric_column = s.numeric_column; -- test new regex functions -- print order comments that contain the word `fluffily` at least twice SELECT o_comment FROM public.orders WHERE regexp_count(o_comment, 'FluFFily', 1, 'i')>=2 ORDER BY 1; - o_comment ---------------------------------------------------------------------- - al, bold deposits cajole fluffily fluffily final foxes. pending ideas beli - ly regular packages are fluffily even ideas. fluffily final - ng instructions integrate fluffily among the fluffily silent accounts. bli - ructions wake fluffily fluffily final gifts! furiou - s boost blithely fluffily idle ideas? fluffily even pin -(5 rows) - +ERROR: relation "public.orders" does not exist -- print the same items using a different regexp function SELECT o_comment FROM public.orders WHERE regexp_like(o_comment, 'fluffily.*fluffily') ORDER BY 1; - o_comment ---------------------------------------------------------------------- - al, bold deposits cajole fluffily fluffily final foxes. pending ideas beli - ly regular packages are fluffily even ideas. fluffily final - ng instructions integrate fluffily among the fluffily silent accounts. bli - ructions wake fluffily fluffily final gifts! furiou - s boost blithely fluffily idle ideas? fluffily even pin -(5 rows) - +ERROR: relation "public.orders" does not exist -- print the position where we find the second fluffily in the comment SELECT o_comment, regexp_instr(o_comment, 'fluffily.*(fluffily)') FROM public.orders ORDER BY 2 desc LIMIT 5; - o_comment | regexp_instr ---------------------------------------------------------------------- - ng instructions integrate fluffily among the fluffily silent accounts. bli | 27 - al, bold deposits cajole fluffily fluffily final foxes. pending ideas beli | 26 - ly regular packages are fluffily even ideas. fluffily final | 25 - s boost blithely fluffily idle ideas? fluffily even pin | 18 - ructions wake fluffily fluffily final gifts! furiou | 15 -(5 rows) - +ERROR: relation "public.orders" does not exist -- print the substrings between two `fluffily` SELECT regexp_substr(o_comment, 'fluffily.*fluffily') FROM public.orders ORDER BY 1 LIMIT 5; - regexp_substr ---------------------------------------------------------------------- - fluffily among the fluffily - fluffily even ideas. fluffily - fluffily fluffily - fluffily fluffily - fluffily idle ideas? fluffily -(5 rows) - +ERROR: relation "public.orders" does not exist -- replace second `fluffily` with `silkily` SELECT regexp_replace(o_comment, 'fluffily', 'silkily', 1, 2) FROM public.orders WHERE regexp_like(o_comment, 'fluffily.*fluffily') ORDER BY 1 desc; - regexp_replace ---------------------------------------------------------------------- - s boost blithely fluffily idle ideas? silkily even pin - ructions wake fluffily silkily final gifts! furiou - ng instructions integrate fluffily among the silkily silent accounts. bli - ly regular packages are fluffily even ideas. silkily final - al, bold deposits cajole fluffily silkily final foxes. pending ideas beli -(5 rows) - +ERROR: relation "public.orders" does not exist -- test new COPY features -- COPY TO statements with text format and headers CREATE TABLE copy_test(id int, data int); @@ -1536,3 +1496,121 @@ SET client_min_messages TO ERROR; DROP SCHEMA pg15 CASCADE; DROP ROLE rls_tenant_1; DROP ROLE rls_tenant_2; +-- create/drop database for pg > 15 +\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' + STRATEGY = 'wal_log' + LOCALE = 'C' + LC_COLLATE = 'C' + LC_CTYPE = 'C' + ICU_LOCALE = 'C' + LOCALE_PROVIDER = 'icu' + COLLATION_VERSION = '1.0' + TABLESPACE = create_drop_db_tablespace + ALLOW_CONNECTIONS = true + IS_TEMPLATE = false + OID = 966345; +SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +pd.datistemplate, pd.datallowconn, pd.datconnlimit, +pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, +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 | datdba | encoding | datlocprovider | datistemplate | datallowconn | datconnlimit | datcollate | datctype | daticulocale | datcollversion | datacl | database_owner | database_owner | tablespace +--------------------------------------------------------------------- + mydatabase | 17851 | 6 | i | f | t | 10 | C | C | C | 1.0 | | create_drop_db_test_user | create_drop_db_test_user | create_drop_db_tablespace +(1 row) + +\c - - - :worker_1_port +SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +pd.datistemplate, pd.datallowconn, pd.datconnlimit, +pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, +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 | datdba | encoding | datlocprovider | datistemplate | datallowconn | datconnlimit | datcollate | datctype | daticulocale | datcollversion | datacl | database_owner | database_owner | tablespace +--------------------------------------------------------------------- + mydatabase | 18201 | 6 | i | f | t | 10 | C | C | C | 1.0 | | create_drop_db_test_user | create_drop_db_test_user | create_drop_db_tablespace +(1 row) + +\c - - - :worker_2_port +SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +pd.datistemplate, pd.datallowconn, pd.datconnlimit, +pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, +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 | datdba | encoding | datlocprovider | datistemplate | datallowconn | datconnlimit | datcollate | datctype | daticulocale | datcollversion | datacl | database_owner | database_owner | tablespace +--------------------------------------------------------------------- + mydatabase | 18174 | 6 | i | f | t | 10 | C | C | C | 1.0 | | 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.datdba, pd.encoding, pd.datlocprovider, +pd.datistemplate, pd.datallowconn, pd.datconnlimit, +pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, +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 | datdba | encoding | datlocprovider | datistemplate | datallowconn | datconnlimit | datcollate | datctype | daticulocale | datcollversion | datacl | database_owner | database_owner | tablespace +--------------------------------------------------------------------- +(0 rows) + +\c - - - :worker_1_port +SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +pd.datistemplate, pd.datallowconn, pd.datconnlimit, +pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, +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 | datdba | encoding | datlocprovider | datistemplate | datallowconn | datconnlimit | datcollate | datctype | daticulocale | datcollversion | datacl | database_owner | database_owner | tablespace +--------------------------------------------------------------------- +(0 rows) + +\c - - - :worker_2_port +SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +pd.datistemplate, pd.datallowconn, pd.datconnlimit, +pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, +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 | datdba | encoding | datlocprovider | datistemplate | datallowconn | datconnlimit | datcollate | datctype | daticulocale | datcollversion | datacl | database_owner | database_owner | tablespace +--------------------------------------------------------------------- +(0 rows) + +\c - - - :master_port +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; diff --git a/src/test/regress/pg_regress_multi.pl b/src/test/regress/pg_regress_multi.pl index 4cc022198..ba2251e37 100755 --- a/src/test/regress/pg_regress_multi.pl +++ b/src/test/regress/pg_regress_multi.pl @@ -630,7 +630,7 @@ for my $port (@followerWorkerPorts) } } -for my $tablespace ("ts0", "ts1", "ts2") +for my $tablespace ("ts0", "ts1", "ts2", "ts3", "ts4", "ts5") { if (-e catfile($TMP_CHECKDIR, $tablespace)) { diff --git a/src/test/regress/sql/create_drop_database_propagation.sql b/src/test/regress/sql/create_drop_database_propagation.sql index 487f13826..cfcd21e67 100644 --- a/src/test/regress/sql/create_drop_database_propagation.sql +++ b/src/test/regress/sql/create_drop_database_propagation.sql @@ -1,45 +1,111 @@ -set citus.enable_create_database_propagation=on; + + +\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' - STRATEGY = 'wal_log' - LOCALE = 'C' LC_COLLATE = 'C' LC_CTYPE = 'C' - ICU_LOCALE = 'C' - LOCALE_PROVIDER = 'icu' - COLLATION_VERSION = '1.0' TABLESPACE = test_tablespace ALLOW_CONNECTIONS = true - IS_TEMPLATE = false - OID = 966345; + IS_TEMPLATE = false; -SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +SELECT pd.datname , pd.datdba, pd.encoding, pd.datistemplate, pd.datallowconn, pd.datconnlimit, -pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, -pd.datacl, rolname AS database_owner, pa.rolname AS database_owner, pt.spcname AS tablespace +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'; +\c - - - :worker_1_port + +SELECT pd.datname , pd.datdba, 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'; +\c - - - :worker_2_port + +SELECT pd.datname , pd.datdba, 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'; + +\c - - - :master_port +set citus.enable_create_database_propagation=on; drop database mydatabase; -SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +SELECT pd.datname , pd.datdba, pd.encoding, pd.datistemplate, pd.datallowconn, pd.datconnlimit, -pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, -pd.datacl, rolname AS database_owner, pa.rolname AS database_owner, pt.spcname AS tablespace +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'; +\c - - - :worker_1_port + +SELECT pd.datname , pd.datdba, 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'; + +\c - - - :worker_2_port + +SELECT pd.datname , pd.datdba, 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'; + +\c - - - :master_port + +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; -set citus.enable_create_database_propagation=off; diff --git a/src/test/regress/sql/pg15.sql b/src/test/regress/sql/pg15.sql index fe60222dd..37270771b 100644 --- a/src/test/regress/sql/pg15.sql +++ b/src/test/regress/sql/pg15.sql @@ -976,3 +976,115 @@ SET client_min_messages TO ERROR; DROP SCHEMA pg15 CASCADE; DROP ROLE rls_tenant_1; DROP ROLE rls_tenant_2; + + +-- create/drop database for pg > 15 + + +\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' + STRATEGY = 'wal_log' + LOCALE = 'C' + LC_COLLATE = 'C' + LC_CTYPE = 'C' + ICU_LOCALE = 'C' + LOCALE_PROVIDER = 'icu' + COLLATION_VERSION = '1.0' + TABLESPACE = create_drop_db_tablespace + ALLOW_CONNECTIONS = true + IS_TEMPLATE = false + OID = 966345; + +SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +pd.datistemplate, pd.datallowconn, pd.datconnlimit, +pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, +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'; + +\c - - - :worker_1_port +SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +pd.datistemplate, pd.datallowconn, pd.datconnlimit, +pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, +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'; + + +\c - - - :worker_2_port +SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +pd.datistemplate, pd.datallowconn, pd.datconnlimit, +pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, +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'; + + +\c - - - :master_port +set citus.enable_create_database_propagation=on; +drop database mydatabase; +SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +pd.datistemplate, pd.datallowconn, pd.datconnlimit, +pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, +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'; + + +\c - - - :worker_1_port +SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +pd.datistemplate, pd.datallowconn, pd.datconnlimit, +pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, +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'; + +\c - - - :worker_2_port + +SELECT pd.datname , pd.datdba, pd.encoding, pd.datlocprovider, +pd.datistemplate, pd.datallowconn, pd.datconnlimit, +pd.datcollate , pd. datctype , pd.daticulocale, pd.datcollversion, +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'; + +\c - - - :master_port +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;