postgresql/src/test
Andrew Gierth 3cf3a65cb7 Set scan direction appropriately for SubPlans (bug #15336)
When executing a SubPlan in an expression, the EState's direction
field was left alone, resulting in an attempt to execute the subplan
backwards if it was encountered during a backwards scan of a cursor.
Also, though much less likely, it was possible to reach the execution
of an InitPlan while in backwards-scan state.

Repair by saving/restoring estate->es_direction and forcing forward
scan mode in the relevant places.

Backpatch all the way, since this has been broken since 8.3 (prior to
commit c7ff7663e, SubPlans had their own EStates rather than sharing
the parent plan's, so there was no confusion over scan direction).

Per bug #15336 reported by Vladimir Baranoff; analysis and patch by
me, review by Tom Lane.

Discussion: https://postgr.es/m/153449812167.1304.1741624125628126322@wrigleys.postgresql.org
2018-08-17 16:23:56 +01:00
..
examples Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-07-09 17:23:32 -04:00
isolation Clean up assorted misuses of snprintf()'s result value. 2018-08-15 16:29:32 -04:00
locale Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00
mb Lots of doc corrections. 2012-04-23 22:43:09 -04:00
performance Run newly-configured perltidy script on Perl files. 2012-07-04 21:47:49 -04:00
perl Install TAP test infrastructure so it's available for extension testing. 2016-09-23 15:50:00 -04:00
regress Set scan direction appropriately for SubPlans (bug #15336) 2018-08-17 16:23:56 +01:00
thread Update copyright for 2014 2014-01-07 16:05:30 -05:00
Makefile Install TAP test infrastructure so it's available for extension testing. 2016-09-23 15:50:00 -04:00