From 8901936e9aa112e7e3de6dabd16aa8b0b28456b9 Mon Sep 17 00:00:00 2001 From: Burak Velioglu Date: Thu, 10 Feb 2022 00:04:51 +0300 Subject: [PATCH] Check whether the function call is in transaction block --- src/backend/distributed/commands/function.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 "