postgresql/src
Tom Lane 517e0fe866 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 Fix assorted errors in pg_dump's handling of extended statistics objects. 2018-02-11 13:24:15 -05:00
common Update copyright in recently added files 2017-07-26 18:17:18 -04:00
fe_utils Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
include Stamp 10.2. 2018-02-05 16:01:02 -05:00
interfaces Stamp 10.2. 2018-02-05 16:01:02 -05:00
makefiles Always use -fPIC, not -fpic, when building shared libraries with gcc. 2017-06-01 13:32:55 -04:00
pl Fix broken logic for reporting PL/Python function names in errcontext. 2018-02-14 14:47:18 -05:00
port Stamp 10.2. 2018-02-05 16:01:02 -05:00
template Remove "sco" and "unixware" ports. 2016-10-11 11:26:04 -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:36 -05:00
tools Fix use of config-specific libraries for Windows OpenSSL 2018-01-03 15:33:12 -05:00
tutorial Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02: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 Build src/test/isolation during "make" and "make install". 2017-11-22 20:18:52 -08:00
Makefile.global.in Be more thorough about cleaning out gcov litter. 2017-08-11 17:39:27 -04:00
Makefile.shlib Remove support for bcc and msvc standalone libpq builds 2017-04-11 15:22:21 +02:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00