set citus.log_remote_commands = true;
set citus.grep_remote_commands = '%ALTER DATABASE%';
alter database regression with CONNECTION LIMIT 100;
NOTICE:  issuing ALTER DATABASE regression WITH CONNECTION LIMIT 100;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression WITH CONNECTION LIMIT 100;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression with IS_TEMPLATE true CONNECTION LIMIT 50;
NOTICE:  issuing ALTER DATABASE regression WITH IS_TEMPLATE true CONNECTION LIMIT 50;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression WITH IS_TEMPLATE true CONNECTION LIMIT 50;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression with CONNECTION LIMIT -1;
NOTICE:  issuing ALTER DATABASE regression WITH CONNECTION LIMIT -1;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression WITH CONNECTION LIMIT -1;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression with IS_TEMPLATE true;
NOTICE:  issuing ALTER DATABASE regression WITH IS_TEMPLATE true;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression WITH IS_TEMPLATE true;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression with IS_TEMPLATE false;
NOTICE:  issuing ALTER DATABASE regression WITH IS_TEMPLATE false;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression WITH IS_TEMPLATE false;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression set default_transaction_read_only = true;
NOTICE:  issuing ALTER DATABASE regression SET default_transaction_read_only = 'true'
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET default_transaction_read_only = 'true'
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
set default_transaction_read_only = false;
alter database regression set default_transaction_read_only from current;
NOTICE:  issuing ALTER DATABASE regression SET default_transaction_read_only FROM CURRENT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET default_transaction_read_only FROM CURRENT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression set default_transaction_read_only to DEFAULT;
NOTICE:  issuing ALTER DATABASE regression SET default_transaction_read_only TO DEFAULT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET default_transaction_read_only TO DEFAULT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression RESET default_transaction_read_only;
NOTICE:  issuing ALTER DATABASE regression RESET default_transaction_read_only
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression RESET default_transaction_read_only
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression SET TIME ZONE '-7';
NOTICE:  issuing ALTER DATABASE regression SET timezone = '-7'
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET timezone = '-7'
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression set TIME ZONE LOCAL;
NOTICE:  issuing ALTER DATABASE regression SET timezone TO DEFAULT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET timezone TO DEFAULT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression set TIME ZONE DEFAULT;
NOTICE:  issuing ALTER DATABASE regression SET timezone TO DEFAULT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET timezone TO DEFAULT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression RESET TIME ZONE;
NOTICE:  issuing ALTER DATABASE regression RESET timezone
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression RESET timezone
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression SET TIME ZONE INTERVAL '-08:00' HOUR TO MINUTE;
NOTICE:  issuing ALTER DATABASE regression SET TIME ZONE INTERVAL '@ 8 hours ago'
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET TIME ZONE INTERVAL '@ 8 hours ago'
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression RESET TIME ZONE;
NOTICE:  issuing ALTER DATABASE regression RESET timezone
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression RESET timezone
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression set default_transaction_isolation = 'serializable';
NOTICE:  issuing ALTER DATABASE regression SET default_transaction_isolation = 'serializable'
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET default_transaction_isolation = 'serializable'
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
set default_transaction_isolation = 'read committed';
alter database regression set default_transaction_isolation from current;
NOTICE:  issuing ALTER DATABASE regression SET default_transaction_isolation FROM CURRENT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET default_transaction_isolation FROM CURRENT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression set default_transaction_isolation to DEFAULT;
NOTICE:  issuing ALTER DATABASE regression SET default_transaction_isolation TO DEFAULT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET default_transaction_isolation TO DEFAULT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression RESET default_transaction_isolation;
NOTICE:  issuing ALTER DATABASE regression RESET default_transaction_isolation
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression RESET default_transaction_isolation
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression set statement_timeout = 1000;
NOTICE:  issuing ALTER DATABASE regression SET statement_timeout = 1000
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET statement_timeout = 1000
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
set statement_timeout = 2000;
alter database regression set statement_timeout from current;
NOTICE:  issuing ALTER DATABASE regression SET statement_timeout FROM CURRENT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET statement_timeout FROM CURRENT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression set statement_timeout to DEFAULT;
NOTICE:  issuing ALTER DATABASE regression SET statement_timeout TO DEFAULT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET statement_timeout TO DEFAULT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression RESET statement_timeout;
NOTICE:  issuing ALTER DATABASE regression RESET statement_timeout
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression RESET statement_timeout
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression set lock_timeout = 1201.5;
NOTICE:  issuing ALTER DATABASE regression SET lock_timeout = 1201.5
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET lock_timeout = 1201.5
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
set lock_timeout = 1202.5;
alter database regression set lock_timeout from current;
NOTICE:  issuing ALTER DATABASE regression SET lock_timeout FROM CURRENT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET lock_timeout FROM CURRENT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression set lock_timeout to DEFAULT;
NOTICE:  issuing ALTER DATABASE regression SET lock_timeout TO DEFAULT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression SET lock_timeout TO DEFAULT
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database regression RESET lock_timeout;
NOTICE:  issuing ALTER DATABASE regression RESET lock_timeout
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE regression RESET lock_timeout
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
set citus.enable_create_database_propagation=on;
SET citus.next_operation_id TO 3000;
create database "regression!'2";
NOTICE:  issuing ALTER DATABASE citus_temp_database_3000_0 RENAME TO "regression!'2"
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE citus_temp_database_3000_0 RENAME TO "regression!'2"
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database "regression!'2" with CONNECTION LIMIT 100;
NOTICE:  issuing ALTER DATABASE "regression!'2" WITH CONNECTION LIMIT 100;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE "regression!'2" WITH CONNECTION LIMIT 100;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database "regression!'2" with IS_TEMPLATE true CONNECTION LIMIT 50;
NOTICE:  issuing ALTER DATABASE "regression!'2" WITH IS_TEMPLATE true CONNECTION LIMIT 50;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE "regression!'2" WITH IS_TEMPLATE true CONNECTION LIMIT 50;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database "regression!'2" with IS_TEMPLATE false;
NOTICE:  issuing ALTER DATABASE "regression!'2" WITH IS_TEMPLATE false;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE "regression!'2" WITH IS_TEMPLATE false;
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
\set alter_db_tablespace :abs_srcdir '/tmp_check/ts3'
CREATE TABLESPACE alter_db_tablespace LOCATION :'alter_db_tablespace';
\c - - - :worker_1_port
\set alter_db_tablespace :abs_srcdir '/tmp_check/ts4'
CREATE TABLESPACE alter_db_tablespace LOCATION :'alter_db_tablespace';
\c - - - :worker_2_port
\set alter_db_tablespace :abs_srcdir '/tmp_check/ts5'
CREATE TABLESPACE alter_db_tablespace LOCATION :'alter_db_tablespace';
\c - - - :master_port
set citus.log_remote_commands = true;
set citus.grep_remote_commands = '%ALTER DATABASE%';
alter database "regression!'2" set TABLESPACE alter_db_tablespace;
NOTICE:  issuing ALTER DATABASE "regression!'2" SET TABLESPACE alter_db_tablespace
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE "regression!'2" SET TABLESPACE alter_db_tablespace
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
set citus.enable_create_database_propagation=on;
alter database "regression!'2" rename to regression3;
NOTICE:  issuing ALTER DATABASE "regression!'2" RENAME TO regression3
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE "regression!'2" RENAME TO regression3
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
-- check that the local database rename and alter comnmand is not propagated
set citus.enable_create_database_propagation=off;
CREATE database local_regression;
NOTICE:  Citus partially supports CREATE DATABASE for distributed databases
DETAIL:  Citus does not propagate CREATE DATABASE command to other nodes
HINT:  You can manually create a database and its extensions on other nodes.
alter DATABASE local_regression with CONNECTION LIMIT 100;
alter DATABASE local_regression rename to local_regression2;
drop database local_regression2;
set citus.enable_create_database_propagation=on;
drop database regression3;
SET citus.next_operation_id TO 3100;
create database "regression!'4";
NOTICE:  issuing ALTER DATABASE citus_temp_database_3100_0 RENAME TO "regression!'4"
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE citus_temp_database_3100_0 RENAME TO "regression!'4"
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
SELECT result FROM run_command_on_all_nodes(
  $$
  ALTER TABLESPACE alter_db_tablespace RENAME TO "ts-needs\!escape"
  $$
);
      result
---------------------------------------------------------------------
 ALTER TABLESPACE
 ALTER TABLESPACE
 ALTER TABLESPACE
(3 rows)

alter database "regression!'4" set TABLESPACE "ts-needs\!escape";
NOTICE:  issuing ALTER DATABASE "regression!'4" SET TABLESPACE "ts-needs\!escape"
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE:  issuing ALTER DATABASE "regression!'4" SET TABLESPACE "ts-needs\!escape"
DETAIL:  on server postgres@localhost:xxxxx connectionId: xxxxxxx
drop database "regression!'4";
set citus.log_remote_commands = false;
set citus.enable_create_database_propagation=off;
SELECT result FROM run_command_on_all_nodes(
  $$
  drop tablespace "ts-needs\!escape"
  $$
);
     result
---------------------------------------------------------------------
 DROP TABLESPACE
 DROP TABLESPACE
 DROP TABLESPACE
(3 rows)

