Fixes review notes

pull/7172/head
gindibay 2023-09-12 02:46:22 +03:00
parent fff24b8736
commit 12254398cb
2 changed files with 23 additions and 84 deletions

View File

@ -5,75 +5,32 @@ set citus.grep_remote_commands = '%ALTER DATABASE%';
-- this statement will get error
alter database regression ALLOW_CONNECTIONS false;
ERROR: ALLOW_CONNECTIONS is not supported
DO $$
declare
v_connlimit_initial numeric;
v_connlimit_fetched int;
begin
select datconnlimit into v_connlimit_initial 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_initial: %, v_connlimit_fetched: %', v_connlimit_initial, v_connlimit_fetched;
execute 'alter database regression with CONNECTION LIMIT ' || v_connlimit_initial;
select datconnlimit into v_connlimit_fetched from pg_database where datname = 'regression';
raise notice 'v_connlimit_initial: %, v_connlimit_fetched: %', v_connlimit_initial, v_connlimit_fetched;
alter database regression with IS_TEMPLATE true CONNECTION LIMIT 100;
execute 'alter database regression with IS_TEMPLATE false CONNECTION LIMIT' || v_connlimit_initial;
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';
end;
$$
language plpgsql;
alter database regression with CONNECTION LIMIT 100;
NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT 100;
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
CONTEXT: SQL statement "alter database regression with CONNECTION LIMIT 100"
PL/pgSQL function inline_code_block line XX at SQL statement
NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT 100;
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
CONTEXT: SQL statement "alter database regression with CONNECTION LIMIT 100"
PL/pgSQL function inline_code_block line XX at SQL statement
NOTICE: v_connlimit_initial: -1, v_connlimit_fetched: 100
CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE
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
CONTEXT: SQL statement "alter database regression with CONNECTION LIMIT -1"
PL/pgSQL function inline_code_block line XX at EXECUTE
NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT -1;
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
CONTEXT: SQL statement "alter database regression with CONNECTION LIMIT -1"
PL/pgSQL function inline_code_block line XX at EXECUTE
NOTICE: v_connlimit_initial: -1, v_connlimit_fetched: -1
CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE
NOTICE: issuing ALTER DATABASE regression WITH is_template 'true' CONNECTION LIMIT 100;
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
CONTEXT: SQL statement "alter database regression with IS_TEMPLATE true CONNECTION LIMIT 100"
PL/pgSQL function inline_code_block line XX at SQL statement
NOTICE: issuing ALTER DATABASE regression WITH is_template 'true' CONNECTION LIMIT 100;
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
CONTEXT: SQL statement "alter database regression with IS_TEMPLATE true CONNECTION LIMIT 100"
PL/pgSQL function inline_code_block line XX at SQL statement
NOTICE: issuing ALTER DATABASE regression WITH is_template 'false' CONNECTION LIMIT -1;
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
CONTEXT: SQL statement "alter database regression with IS_TEMPLATE false CONNECTION LIMIT-1"
PL/pgSQL function inline_code_block line XX at EXECUTE
NOTICE: issuing ALTER DATABASE regression WITH is_template 'false' CONNECTION LIMIT -1;
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
CONTEXT: SQL statement "alter database regression with IS_TEMPLATE false CONNECTION LIMIT-1"
PL/pgSQL function inline_code_block line XX at EXECUTE
alter database regression with IS_TEMPLATE true;
NOTICE: issuing ALTER DATABASE regression WITH is_template 'true';
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
CONTEXT: SQL statement "alter database regression with IS_TEMPLATE true"
PL/pgSQL function inline_code_block line XX at SQL statement
NOTICE: issuing ALTER DATABASE regression WITH is_template 'true';
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
CONTEXT: SQL statement "alter database regression with IS_TEMPLATE true"
PL/pgSQL function inline_code_block line XX at SQL statement
ERROR: query has no destination for result data
HINT: If you want to discard the results of a SELECT, use PERFORM instead.
CONTEXT: PL/pgSQL function inline_code_block line XX at SQL statement
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
-- this statement will get error since we don't have a multiple database support for now
alter database regression rename to regression2;
ERROR: current database cannot be renamed
set citus.log_remote_commands = false;

View File

@ -7,30 +7,12 @@ set citus.grep_remote_commands = '%ALTER DATABASE%';
alter database regression ALLOW_CONNECTIONS false;
DO $$
declare
v_connlimit_initial numeric;
v_connlimit_fetched int;
begin
select datconnlimit into v_connlimit_initial 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_initial: %, v_connlimit_fetched: %', v_connlimit_initial, v_connlimit_fetched;
execute 'alter database regression with CONNECTION LIMIT ' || v_connlimit_initial;
select datconnlimit into v_connlimit_fetched from pg_database where datname = 'regression';
raise notice 'v_connlimit_initial: %, v_connlimit_fetched: %', v_connlimit_initial, v_connlimit_fetched;
alter database regression with IS_TEMPLATE true CONNECTION LIMIT 100;
execute 'alter database regression with IS_TEMPLATE false CONNECTION LIMIT' || v_connlimit_initial;
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';
end;
$$
language plpgsql;
alter database regression with CONNECTION LIMIT 100;
alter database regression with IS_TEMPLATE true CONNECTION LIMIT 50;
alter database regression with CONNECTION LIMIT -1;
alter database regression with IS_TEMPLATE true;
alter database regression with IS_TEMPLATE false;
-- this statement will get error since we don't have a multiple database support for now
alter database regression rename to regression2;
set citus.log_remote_commands = false;