/* Save state for restoration later */
*save_dpns = *dpns;
- /*
- * Currently we don't bother to adjust the ancestors list, because an
- * OUTER_VAR or INNER_VAR reference really shouldn't contain any Params
- * that would be set by the parent node itself. If we did want to adjust
- * the list, lcons'ing dpns->planstate onto dpns->ancestors would be the
- * appropriate thing --- and pop_child_plan would need to undo the change
- * to the list.
- */
+ /* Link current plan node into ancestors list */
+ dpns->ancestors = lcons(dpns->planstate, dpns->ancestors);
/* Set attention on selected child */
set_deparse_planstate(dpns, ps);
static void
pop_child_plan(deparse_namespace *dpns, deparse_namespace *save_dpns)
{
+ List *ancestors;
+
+ /* Get rid of ancestors list cell added by push_child_plan */
+ ancestors = list_delete_first(dpns->ancestors);
+
/* Restore fields changed by push_child_plan */
*dpns = *save_dpns;
+
+ /* Make sure dpns->ancestors is right (may be unnecessary) */
+ dpns->ancestors = ancestors;
}
/*
Nested Loop
-> Seq Scan on int8_tbl a
-> Hash Left Join
- Hash Cond: (x.q2 = ($0))
+ Hash Cond: (x.q2 = (a.q1))
-> Seq Scan on int8_tbl x
-> Hash
-> Seq Scan on int4_tbl y