Add extension ownership check

velioglu/tmpfuncprop
Burak Velioglu 2022-02-14 13:06:28 +03:00
parent b25a1c48e6
commit 38213e09ad
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
1 changed files with 9 additions and 4 deletions

View File

@ -1329,8 +1329,8 @@ PostprocessCreateFunctionStmt(Node *node, const char *queryString)
return NIL; return NIL;
} }
ObjectAddress address = GetObjectAddressFromParseTree((Node *) stmt, false); ObjectAddress functionAddress = GetObjectAddressFromParseTree((Node *) stmt, false);
if (!DependentRelationsOfFunctionCanBeDistributed(&address)) if (!DependentRelationsOfFunctionCanBeDistributed(&functionAddress))
{ {
ereport(WARNING, (errmsg("Citus can't distribute functions having dependency on" ereport(WARNING, (errmsg("Citus can't distribute functions having dependency on"
" non-distributed relations"), " non-distributed relations"),
@ -1340,10 +1340,15 @@ PostprocessCreateFunctionStmt(Node *node, const char *queryString)
return NIL; return NIL;
} }
EnsureDependenciesExistOnAllNodes(&address); if (IsObjectAddressOwnedByExtension(&functionAddress, NULL))
{
return NIL;
}
EnsureDependenciesExistOnAllNodes(&functionAddress);
List *commands = list_make1(DISABLE_DDL_PROPAGATION); List *commands = list_make1(DISABLE_DDL_PROPAGATION);
commands = list_concat(commands, CreateFunctionDDLCommandsIdempotent(&address)); commands = list_concat(commands, CreateFunctionDDLCommandsIdempotent(&functionAddress));
commands = list_concat(commands, list_make1(ENABLE_DDL_PROPAGATION)); commands = list_concat(commands, list_make1(ENABLE_DDL_PROPAGATION));
return NodeDDLTaskList(NON_COORDINATOR_NODES, commands); return NodeDDLTaskList(NON_COORDINATOR_NODES, commands);