On Wed, Apr 20, 2022 at 10:47:07AM +0800, Julien Rouhaud wrote: > > AFAICT the problem is that SET / RESET part is messing with the HeapTuple, so > you can't use the procForm reference afterwards. Simply processing > parallel_item before set_items fixes the problem, as in the attached. This time with the file.
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index 91f02a7eb2..c227fbde19 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -1472,6 +1472,8 @@ AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt) procForm->prosupport = newsupport; } + if (parallel_item) + procForm->proparallel = interpret_func_parallel(parallel_item); if (set_items) { Datum datum; @@ -1506,8 +1508,6 @@ AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt) tup = heap_modify_tuple(tup, RelationGetDescr(rel), repl_val, repl_null, repl_repl); } - if (parallel_item) - procForm->proparallel = interpret_func_parallel(parallel_item); /* Do the update */ CatalogTupleUpdate(rel, &tup->t_self, tup);