Fixes pg14 tests

pull/7240/head
gindibay 2023-10-27 17:40:37 +03:00
parent 8c29444bbf
commit 2b3a556f34
2 changed files with 10 additions and 58 deletions

View File

@ -164,7 +164,8 @@ CREATE DATABASE my_template_database
WITH TEMPLATE = 'template0'
OWNER = create_drop_db_test_user
ENCODING = 'UTF8'
LOCALE = 'en_US.utf8'
LC_COLLATE = 'C'
LC_CTYPE = 'C'
TABLESPACE = create_drop_db_tablespace
ALLOW_CONNECTIONS = false
IS_TEMPLATE = true;
@ -183,40 +184,13 @@ SELECT result from run_command_on_all_nodes(
) q2
$$
) ORDER BY result;
result
result
---------------------------------------------------------------------
[{"datacl": null, "datname": "my_template_database", "datctype": "en_US.utf8", "encoding": "UTF8", "datcollate": "en_US.utf8", "tablespace": "create_drop_db_tablespace", "datallowconn": false, "datconnlimit": -1, "datistemplate": true, "database_owner": "create_drop_db_test_user"}]
[{"datacl": null, "datname": "my_template_database", "datctype": "en_US.utf8", "encoding": "UTF8", "datcollate": "en_US.utf8", "tablespace": "create_drop_db_tablespace", "datallowconn": false, "datconnlimit": -1, "datistemplate": true, "database_owner": "create_drop_db_test_user"}]
[{"datacl": null, "datname": "my_template_database", "datctype": "en_US.utf8", "encoding": "UTF8", "datcollate": "en_US.utf8", "tablespace": "create_drop_db_tablespace", "datallowconn": false, "datconnlimit": -1, "datistemplate": true, "database_owner": "create_drop_db_test_user"}]
[{"datacl": null, "datname": "my_template_database", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "create_drop_db_tablespace", "datallowconn": false, "datconnlimit": -1, "datistemplate": true, "database_owner": "create_drop_db_test_user"}]
[{"datacl": null, "datname": "my_template_database", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "create_drop_db_tablespace", "datallowconn": false, "datconnlimit": -1, "datistemplate": true, "database_owner": "create_drop_db_test_user"}]
[{"datacl": null, "datname": "my_template_database", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "create_drop_db_tablespace", "datallowconn": false, "datconnlimit": -1, "datistemplate": true, "database_owner": "create_drop_db_test_user"}]
(3 rows)
SET citus.log_remote_commands = true;
set citus.grep_remote_commands = '%DROP DATABASE%';
drop database my_template_database;
ERROR: cannot drop a template database
SET citus.log_remote_commands = false;
SELECT result from run_command_on_all_nodes(
$$
SELECT jsonb_agg(to_jsonb(q2.*)) FROM (
SELECT pd.datname, pg_encoding_to_char(pd.encoding) as 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 = 'my_template_database'
) q2
$$
) ORDER BY result;
result
---------------------------------------------------------------------
[{"datacl": null, "datname": "my_template_database", "datctype": "en_US.utf8", "encoding": "UTF8", "datcollate": "en_US.utf8", "tablespace": "create_drop_db_tablespace", "datallowconn": false, "datconnlimit": -1, "datistemplate": true, "database_owner": "create_drop_db_test_user"}]
[{"datacl": null, "datname": "my_template_database", "datctype": "en_US.utf8", "encoding": "UTF8", "datcollate": "en_US.utf8", "tablespace": "create_drop_db_tablespace", "datallowconn": false, "datconnlimit": -1, "datistemplate": true, "database_owner": "create_drop_db_test_user"}]
[{"datacl": null, "datname": "my_template_database", "datctype": "en_US.utf8", "encoding": "UTF8", "datcollate": "en_US.utf8", "tablespace": "create_drop_db_tablespace", "datallowconn": false, "datconnlimit": -1, "datistemplate": true, "database_owner": "create_drop_db_test_user"}]
(3 rows)
SET citus.log_remote_commands = true;
--template databases could not be dropped so we need to change the template flag
SELECT result from run_command_on_all_nodes(
$$
@ -230,7 +204,7 @@ SELECT result from run_command_on_all_nodes(
UPDATE 1
(3 rows)
;
SET citus.log_remote_commands = true;
set citus.grep_remote_commands = '%DROP DATABASE%';
drop database my_template_database;
NOTICE: issuing DROP DATABASE my_template_database

View File

@ -142,7 +142,8 @@ CREATE DATABASE my_template_database
WITH TEMPLATE = 'template0'
OWNER = create_drop_db_test_user
ENCODING = 'UTF8'
LOCALE = 'en_US.utf8'
LC_COLLATE = 'C'
LC_CTYPE = 'C'
TABLESPACE = create_drop_db_tablespace
ALLOW_CONNECTIONS = false
IS_TEMPLATE = true;
@ -164,29 +165,6 @@ SELECT result from run_command_on_all_nodes(
$$
) ORDER BY result;
SET citus.log_remote_commands = true;
set citus.grep_remote_commands = '%DROP DATABASE%';
drop database my_template_database;
SET citus.log_remote_commands = false;
SELECT result from run_command_on_all_nodes(
$$
SELECT jsonb_agg(to_jsonb(q2.*)) FROM (
SELECT pd.datname, pg_encoding_to_char(pd.encoding) as 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 = 'my_template_database'
) q2
$$
) ORDER BY result;
SET citus.log_remote_commands = true;
--template databases could not be dropped so we need to change the template flag
SELECT result from run_command_on_all_nodes(
$$
@ -194,7 +172,7 @@ SELECT result from run_command_on_all_nodes(
$$
) ORDER BY result;
;
SET citus.log_remote_commands = true;
set citus.grep_remote_commands = '%DROP DATABASE%';
drop database my_template_database;