aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-04-19 23:03:59 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2022-04-19 23:03:59 -0400
commit481a99811a416ebb0e1b3b15628752a00bdca672 (patch)
tree5aadf3cb8f254b17b2eab86e180f33412a76c22a /src
parent59348fbdeb7b4e39c992779232ab47069d272135 (diff)
downloadpostgresql-481a99811a416ebb0e1b3b15628752a00bdca672.tar.gz
postgresql-481a99811a416ebb0e1b3b15628752a00bdca672.zip
Fix breakage in AlterFunction().
An ALTER FUNCTION command that tried to update both the function's proparallel property and its proconfig list failed to do the former, because it stored the new proparallel value into a tuple that was no longer the interesting one. Carelessness in 7aea8e4f2. (I did not bother with a regression test, because the only likely future breakage would be for someone to ignore the comment I added and add some other field update after the heap_modify_tuple step. A test using existing function properties could not catch that.) Per report from Bryn Llewellyn. Back-patch to all supported branches. Discussion: https://postgr.es/m/8AC9A37F-99BD-446F-A2F7-B89AD0022774@yugabyte.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/functioncmds.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index 3698ab90bcd..507b075acea 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -1352,6 +1352,8 @@ AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
procForm->prosupport = newsupport;
}
+ if (parallel_item)
+ procForm->proparallel = interpret_func_parallel(parallel_item);
if (set_items)
{
Datum datum;
@@ -1386,8 +1388,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);