diff --git a/src/backend/distributed/commands/function.c b/src/backend/distributed/commands/function.c index 97dcca3ca..0c3544486 100644 --- a/src/backend/distributed/commands/function.c +++ b/src/backend/distributed/commands/function.c @@ -1169,6 +1169,12 @@ GetAggregateDDLCommand(const RegProcedure funcOid, bool useCreateOrReplace) static void EnsureSequentialModeForFunctionDDL(void) { + if (!IsTransactionBlock()) + { + /* we do not need to switch to sequential mode if we are not in a transaction */ + return; + } + if (ParallelQueryExecutedInTransaction()) { ereport(ERROR, (errmsg("cannot create function because there was a "