Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 39ae0ef

Browse files
committed
Fix EXPLAIN of SEARCH BREADTH FIRST queries some more.
Commit 3f50b82 had an oversight: formerly, to deparse expressions attached to a plan node, it was only necessary to update the deparse_namespace ancestors list alongside calling set_deparse_plan. Now it's necessary to update the ancestors list *first*, because set_deparse_plan consults it, and one call site got that wrong. This error was masked in most cases because explain.c uses just one List object for the ancestors list, updating it in-place as the plan is scanned, so that we accidentally had the right List assigned to dpns->ancestors before it was needed. It would fail only if a WorkTableScan node were the first one that we tried to deparse a subexpression of. Per report from Markus Winand. Like the previous patch, back-patch to v14. Discussion: https://postgr.es/m/648B0505-AA57-42C2-A2DA-E551DE46FA15@winand.at
1 parent 68f7c4b commit 39ae0ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/utils/adt/ruleutils.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -3681,8 +3681,8 @@ set_deparse_context_plan(List *dpcontext, Plan *plan, List *ancestors)
36813681
dpns = (deparse_namespace *) linitial(dpcontext);
36823682

36833683
/* Set our attention on the specific plan node passed in */
3684-
set_deparse_plan(dpns, plan);
36853684
dpns->ancestors = ancestors;
3685+
set_deparse_plan(dpns, plan);
36863686

36873687
return dpcontext;
36883688
}
@@ -4836,7 +4836,7 @@ get_rtable_name(int rtindex, deparse_context *context)
48364836
* of a given Plan node
48374837
*
48384838
* This sets the plan, outer_plan, inner_plan, outer_tlist, inner_tlist,
4839-
* and index_tlist fields. Caller is responsible for adjusting the ancestors
4839+
* and index_tlist fields. Caller must already have adjusted the ancestors
48404840
* list if necessary. Note that the rtable, subplans, and ctes fields do
48414841
* not need to change when shifting attention to different plan nodes in a
48424842
* single plan tree.

0 commit comments

Comments
 (0)