Prevent create_distributed_function() from the workers

As this could cause weird edge cases.
pull/3604/head
Onder Kalaci 2020-03-10 18:24:20 +01:00
parent e902581cb6
commit 7d787e3d5e
3 changed files with 18 additions and 0 deletions

View File

@ -148,6 +148,7 @@ create_distributed_function(PG_FUNCTION_ARGS)
colocateWithTableName = text_to_cstring(colocateWithText);
}
EnsureCoordinator();
EnsureFunctionOwner(funcOid);
ObjectAddressSet(functionAddress, ProcedureRelationId, funcOid);

View File

@ -692,6 +692,14 @@ DEBUG: pushing down the function call
28
(1 row)
\c - - - :worker_1_port
SET search_path TO multi_mx_function_call_delegation, public;
-- create_distributed_function is disallowed from worker nodes
select create_distributed_function('mx_call_func(int,int)');
ERROR: operation is not allowed on this node
HINT: Connect to the coordinator and run it again.
\c - - - :master_port
SET search_path TO multi_mx_function_call_delegation, public;
RESET client_min_messages;
\set VERBOSITY terse
DROP SCHEMA multi_mx_function_call_delegation CASCADE;

View File

@ -83,6 +83,7 @@ select create_distributed_function('mx_call_func_bigint(bigint,bigint)');
select create_distributed_function('mx_call_func_custom_types(mx_call_enum,mx_call_enum)');
select create_distributed_function('squares(int)');
-- We still don't route them to the workers, because they aren't
-- colocated with any distributed tables.
SET client_min_messages TO DEBUG1;
@ -259,6 +260,14 @@ EXECUTE call_plan(2, 0);
EXECUTE call_plan(2, 0);
EXECUTE call_plan(2, 0);
\c - - - :worker_1_port
SET search_path TO multi_mx_function_call_delegation, public;
-- create_distributed_function is disallowed from worker nodes
select create_distributed_function('mx_call_func(int,int)');
\c - - - :master_port
SET search_path TO multi_mx_function_call_delegation, public;
RESET client_min_messages;
\set VERBOSITY terse
DROP SCHEMA multi_mx_function_call_delegation CASCADE;