diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index 7de844b2cad..a2275a0c6bd 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -1253,6 +1253,8 @@ AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt) (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("ROWS is not applicable when function does not return a set"))); } + if (parallel_item) + procForm->proparallel = interpret_func_parallel(parallel_item); if (set_items) { Datum datum; @@ -1287,8 +1289,7 @@ 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 NOT put more touches of procForm below here; it's now dangling. */ /* Do the update */ CatalogTupleUpdate(rel, &tup->t_self, tup);