Andres Freund <andres(at)anarazel(dot)de> writes:
> Looking as to why that reference isn't corrected.
It's the bare Param that's the problem; the planner should've converted
that to a Var referencing the Param evaluated in the child plan node.
Working on patch now.
regards, tom lane