Re: BUG #15336: Wrong cursor's bacward fetch results in select with ALL(subquery)

Andrew Gierth <andrew@tao11.riddles.org.uk>

From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-bugs@lists.postgresql.org, v.g.baranoff@gmail.com, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2018-08-17T14:38:41Z
Lists: pgsql-bugs
>>>>> "Alvaro" == Alvaro Herrera <alvherre@2ndquadrant.com> writes:

 >> I wonder if we have a contender here for the oldest reported bug in
 >> PG history; while I haven't tested anything older than 9.5, the
 >> incorrect logic seems to date back to the introduction of subqueries
 >> in 6.something.

 Alvaro> Hmm ..

 Alvaro> 8.2 seems fine:

Hah. You're right; the bug is only 10 years old, not 20. It was
apparently introduced in 8.3 by commit c7ff7663e; before that, SubPlans
had a separate EState from the parent plan, so they didn't share the
parent plan's direction indicator.

-- 
Andrew (irc:RhodiumToad)


Commits

  1. Set scan direction appropriately for SubPlans (bug #15336)

  2. Get rid of the separate EState for subplans, and just let them share the