diff --git a/src/test/regress/expected/alter_database_propagation.out b/src/test/regress/expected/alter_database_propagation.out new file mode 100644 index 000000000..7c97233e2 --- /dev/null +++ b/src/test/regress/expected/alter_database_propagation.out @@ -0,0 +1,47 @@ +--since ALLOW_CONNECTIONS alter option should be executed in a different database +-- and since we don't have a multiple database support for now, +-- this statement will get error +alter database regression ALLOW_CONNECTIONS false; +ERROR: ALLOW_CONNECTIONS is not supported +DO $$ +declare + v_connlimit numeric; + v_connlimit_fetched int; +begin + select datconnlimit into v_connlimit from pg_database where datname = 'regression'; + alter database regression with CONNECTION LIMIT 100; + select datconnlimit into v_connlimit_fetched from pg_database where datname = 'regression'; + raise notice 'v_connlimit: %, v_connlimit_fetched: %', v_connlimit, v_connlimit_fetched; + execute 'alter database regression with CONNECTION LIMIT ' || v_connlimit; + select datconnlimit into v_connlimit_fetched from pg_database where datname = 'regression'; + raise notice 'v_connlimit: %, v_connlimit_fetched: %', v_connlimit, v_connlimit_fetched; +end; +$$ +language plpgsql; +NOTICE: v_connlimit: -1, v_connlimit_fetched: 100 +CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE +NOTICE: v_connlimit: -1, v_connlimit_fetched: -1 +CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE +alter database regression with IS_TEMPLATE true; +select datistemplate from pg_database where datname = 'regression'; + datistemplate +--------------------------------------------------------------------- + t +(1 row) + +alter database regression with IS_TEMPLATE false; +select datistemplate from pg_database where datname = 'regression'; + datistemplate +--------------------------------------------------------------------- + f +(1 row) + +set citus.log_remote_commands = true; +set citus.grep_remote_commands = '%ALTER DATABASE%'; +alter database regression REFRESH COLLATION VERSION; +NOTICE: version has not changed +NOTICE: issuing ALTER DATABASE regression REFRESH COLLATION VERSION; +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +NOTICE: issuing ALTER DATABASE regression REFRESH COLLATION VERSION; +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +set citus.log_remote_commands = false; diff --git a/src/test/regress/multi_1_schedule b/src/test/regress/multi_1_schedule index 14199e247..0c9ec4ab3 100644 --- a/src/test/regress/multi_1_schedule +++ b/src/test/regress/multi_1_schedule @@ -51,6 +51,7 @@ test: multi_metadata_attributes test: multi_read_from_secondaries test: grant_on_database_propagation +test: alter_database_propagation # ---------- # multi_citus_tools tests utility functions written for citus tools diff --git a/src/test/regress/sql/alter_database_propagation.sql b/src/test/regress/sql/alter_database_propagation.sql new file mode 100644 index 000000000..a16008a73 --- /dev/null +++ b/src/test/regress/sql/alter_database_propagation.sql @@ -0,0 +1,38 @@ +--since ALLOW_CONNECTIONS alter option should be executed in a different database +-- and since we don't have a multiple database support for now, +-- this statement will get error +alter database regression ALLOW_CONNECTIONS false; + + +DO $$ +declare + v_connlimit numeric; + v_connlimit_fetched int; +begin + select datconnlimit into v_connlimit from pg_database where datname = 'regression'; + alter database regression with CONNECTION LIMIT 100; + select datconnlimit into v_connlimit_fetched from pg_database where datname = 'regression'; + raise notice 'v_connlimit: %, v_connlimit_fetched: %', v_connlimit, v_connlimit_fetched; + execute 'alter database regression with CONNECTION LIMIT ' || v_connlimit; + select datconnlimit into v_connlimit_fetched from pg_database where datname = 'regression'; + raise notice 'v_connlimit: %, v_connlimit_fetched: %', v_connlimit, v_connlimit_fetched; +end; +$$ +language plpgsql; + + +alter database regression with IS_TEMPLATE true; +select datistemplate from pg_database where datname = 'regression'; + +alter database regression with IS_TEMPLATE false; +select datistemplate from pg_database where datname = 'regression'; + +set citus.log_remote_commands = true; +set citus.grep_remote_commands = '%ALTER DATABASE%'; +alter database regression REFRESH COLLATION VERSION; +set citus.log_remote_commands = false; + + + + +