mirror of https://github.com/citusdata/citus.git
Fixes review notes
parent
a8fae40417
commit
971a4869a9
|
@ -1702,9 +1702,30 @@ IsStatementSupportedFromNonMainDb(Node *parsetree)
|
||||||
sizeof(NonMainDbSupportedStatements[0]); i++)
|
sizeof(NonMainDbSupportedStatements[0]); i++)
|
||||||
{
|
{
|
||||||
if (type == NonMainDbSupportedStatements[i].statementType)
|
if (type == NonMainDbSupportedStatements[i].statementType)
|
||||||
|
{
|
||||||
|
if (NonMainDbSupportedStatements[i].supportedObjectTypes == NULL)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (type == T_GrantStmt)
|
||||||
|
{
|
||||||
|
GrantStmt *stmt = castNode(GrantStmt, parsetree);
|
||||||
|
/* check if stmt->objtype is in supportedObjectTypes */
|
||||||
|
for (int j = 0; j <
|
||||||
|
NonMainDbSupportedStatements[i].supportedObjectTypesSize; j++)
|
||||||
|
{
|
||||||
|
if (stmt->objtype ==
|
||||||
|
NonMainDbSupportedStatements[i].supportedObjectTypes[j])
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -467,4 +467,5 @@ grant connect,temp,temporary on database test_2pc_db to public;
|
||||||
drop database test_2pc_db;
|
drop database test_2pc_db;
|
||||||
set citus.enable_create_database_propagation to off;
|
set citus.enable_create_database_propagation to off;
|
||||||
DROP SCHEMA grant_on_database_propagation_non_maindb CASCADE;
|
DROP SCHEMA grant_on_database_propagation_non_maindb CASCADE;
|
||||||
|
reset citus.enable_create_database_propagation;
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
set citus.enable_create_database_propagation to on;
|
set citus.enable_create_database_propagation to on;
|
||||||
create database test_2pc_db;
|
create database test_2pc_db;
|
||||||
show citus.main_db;
|
show citus.main_db;
|
||||||
|
|
||||||
revoke connect,temp,temporary on database test_2pc_db from public;
|
revoke connect,temp,temporary on database test_2pc_db from public;
|
||||||
|
|
||||||
CREATE SCHEMA grant_on_database_propagation_non_maindb;
|
CREATE SCHEMA grant_on_database_propagation_non_maindb;
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
|
|
||||||
CREATE SCHEMA metadata_sync_2pc_schema;
|
CREATE SCHEMA metadata_sync_2pc_schema;
|
||||||
|
|
||||||
SET search_path TO metadata_sync_2pc_schema;
|
SET search_path TO metadata_sync_2pc_schema;
|
||||||
|
|
||||||
set citus.enable_create_database_propagation to on;
|
set citus.enable_create_database_propagation to on;
|
||||||
|
|
||||||
|
|
||||||
CREATE DATABASE metadata_sync_2pc_db;
|
CREATE DATABASE metadata_sync_2pc_db;
|
||||||
|
|
||||||
revoke connect,temp,temporary on database metadata_sync_2pc_db from public;
|
revoke connect,temp,temporary on database metadata_sync_2pc_db from public;
|
||||||
|
|
||||||
|
|
||||||
\c metadata_sync_2pc_db
|
\c metadata_sync_2pc_db
|
||||||
SHOW citus.main_db;
|
SHOW citus.main_db;
|
||||||
|
|
||||||
|
@ -44,7 +39,6 @@ select check_database_privileges('grant_role2pc''_user3','metadata_sync_2pc_db',
|
||||||
set citus.enable_create_database_propagation to on;
|
set citus.enable_create_database_propagation to on;
|
||||||
select 1 from citus_add_node('localhost', :worker_2_port);
|
select 1 from citus_add_node('localhost', :worker_2_port);
|
||||||
|
|
||||||
|
|
||||||
select result FROM run_command_on_all_nodes($$
|
select result FROM run_command_on_all_nodes($$
|
||||||
SELECT array_to_json(array_agg(row_to_json(t)))
|
SELECT array_to_json(array_agg(row_to_json(t)))
|
||||||
FROM (
|
FROM (
|
||||||
|
@ -60,7 +54,6 @@ select check_database_privileges('grant_role2pc''_user1','metadata_sync_2pc_db',
|
||||||
select check_database_privileges('grant_role2pc''_user2','metadata_sync_2pc_db',ARRAY['CONNECT']);
|
select check_database_privileges('grant_role2pc''_user2','metadata_sync_2pc_db',ARRAY['CONNECT']);
|
||||||
select check_database_privileges('grant_role2pc''_user3','metadata_sync_2pc_db',ARRAY['CREATE','CONNECT','TEMP','TEMPORARY']);
|
select check_database_privileges('grant_role2pc''_user3','metadata_sync_2pc_db',ARRAY['CREATE','CONNECT','TEMP','TEMPORARY']);
|
||||||
|
|
||||||
|
|
||||||
\c metadata_sync_2pc_db
|
\c metadata_sync_2pc_db
|
||||||
revoke "grant_role2pc'_user1","grant_role2pc'_user2" from grant_role2pc_user4,grant_role2pc_user5 granted by "grant_role2pc'_user3";
|
revoke "grant_role2pc'_user1","grant_role2pc'_user2" from grant_role2pc_user4,grant_role2pc_user5 granted by "grant_role2pc'_user3";
|
||||||
|
|
||||||
|
@ -76,9 +69,7 @@ revoke CREATE on database metadata_sync_2pc_db from "grant_role2pc'_user1";
|
||||||
drop user "grant_role2pc'_user1","grant_role2pc'_user2","grant_role2pc'_user3",grant_role2pc_user4,grant_role2pc_user5;
|
drop user "grant_role2pc'_user1","grant_role2pc'_user2","grant_role2pc'_user3",grant_role2pc_user4,grant_role2pc_user5;
|
||||||
set citus.enable_create_database_propagation to on;
|
set citus.enable_create_database_propagation to on;
|
||||||
drop database metadata_sync_2pc_db;
|
drop database metadata_sync_2pc_db;
|
||||||
|
|
||||||
drop schema metadata_sync_2pc_schema;
|
drop schema metadata_sync_2pc_schema;
|
||||||
|
|
||||||
reset citus.enable_create_database_propagation;
|
reset citus.enable_create_database_propagation;
|
||||||
reset search_path;
|
reset search_path;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue