>>>>> "Andrew" == Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:
Andrew> I'm guessing that locally saving/restoring the scan direction
Andrew> in ExecSubPlan is going to be the best option; it seems to fix
Andrew> the problem, I'll post a patch in a bit.
It turns out to be also necessary to do this in ExecSetParamPlan, though
I couldn't find a way to make a stable regression test for that - my
manual tests were based on putting a subselect inside a volatile
construct like CASE WHEN random() < x THEN.
Patch attached.
--
Andrew (irc:RhodiumToad)