From: Amit Kapila Date: Fri, 22 Jun 2018 03:13:36 +0000 (+0530) Subject: Improve coding pattern in Parallel Append code. X-Git-Tag: REL_11_BETA2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98d476a965eefb52af53f4fb55dbfead0ede9282;p=postgresql Improve coding pattern in Parallel Append code. The create_append_path code didn't consider that list_concat will modify it's first argument leading to inconsistent traversal of resulting list. In practice, it won't lead to any user-visible bug but changing it for making the code behave consistently. Reported-by: Tom Lane Author: Tom Lane Reviewed-by: Amit Khandekar and Amit Kapila Discussion: https://postgr.es/m/32365.1528994120@sss.pgh.pa.us --- diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index e190ad49d1..dbf9adcdac 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -1274,7 +1274,7 @@ create_append_path(PlannerInfo *root, pathnode->first_partial_path = list_length(subpaths); pathnode->subpaths = list_concat(subpaths, partial_subpaths); - foreach(l, subpaths) + foreach(l, pathnode->subpaths) { Path *subpath = (Path *) lfirst(l);