postgresql/src
Tom Lane e11b6488e5 Fix misbehavior of CTE-used-in-a-subplan during EPQ rechecks.
An updating query that reads a CTE within an InitPlan or SubPlan could get
incorrect results if it updates rows that are concurrently being modified.
This is caused by CteScanNext supposing that nothing inside its recursive
ExecProcNode call could change which read pointer is selected in the CTE's
shared tuplestore.  While that's normally true because of scoping
considerations, it can break down if an EPQ plan tree gets built during the
call, because EvalPlanQualStart builds execution trees for all subplans
whether they're going to be used during the recheck or not.  And it seems
like a pretty shaky assumption anyway, so let's just reselect our own read
pointer here.

Per bug #14870 from Andrei Gorita.  This has been broken since CTEs were
implemented, so back-patch to all supported branches.

Discussion: https://postgr.es/m/20171024155358.1471.82377@wrigleys.postgresql.org
2018-02-19 16:00:18 -05:00
..
backend Fix misbehavior of CTE-used-in-a-subplan during EPQ rechecks. 2018-02-19 16:00:18 -05:00
bin Translation updates 2018-02-05 12:45:45 -05:00
common Unlink static libraries before rebuilding them. 2015-03-01 13:06:33 -05:00
include Stamp 9.4.16. 2018-02-05 16:07:03 -05:00
interfaces Stamp 9.4.16. 2018-02-05 16:07:03 -05:00
makefiles Always use -fPIC, not -fpic, when building shared libraries with gcc. 2017-06-01 13:32:56 -04:00
pl Fix broken logic for reporting PL/Python function names in errcontext. 2018-02-14 14:47:18 -05:00
port Stamp 9.4.16. 2018-02-05 16:07:03 -05:00
template AIX: Test the -qlonglong option before use. 2015-07-17 03:01:35 -04:00
test Fix misbehavior of CTE-used-in-a-subplan during EPQ rechecks. 2018-02-19 16:00:18 -05:00
timezone Update time zone data files to tzdata release 2018c. 2018-01-27 16:42:55 -05:00
tools Exclude common/int128.h from cpluspluscheck 2018-01-30 19:21:19 -05:00
tutorial pgindent run for 9.4 2014-05-06 12:12:18 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Install TAP test infrastructure so it's available for extension testing. 2016-09-23 15:50:00 -04:00
Makefile.global.in PL/Perl portability fix: absorb relevant -D switches from Perl. 2017-07-31 12:38:35 -04:00
Makefile.shlib Fix typos in comments. 2017-02-06 11:34:24 +02:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00