Robert Haas <robertmh...@gmail.com> writes: > On Tue, Nov 14, 2017 at 12:00 AM, Amit Kapila <amit.kapil...@gmail.com> wrote: >> Am I missing something? Do you have some test or shape of the plan in >> mind which can cause a problem?
> The problem would happen if the plan for InitPlan $1 in the above > example itself referenced a parameter from an upper query level, and > the value of that parameter changed, and then this section of the plan > tree was rescanned. I'm not sure I can write a query like that > off-hand, but I think it's possible to do so. Yeah, I'm sure it is. I have a vague recollection that there might be existing regression test cases exercising such things, though I won't swear to that. The "orderstest" bit in subselect.sql looks like it might be meant to do that... regards, tom lane