postgresql/src
Tom Lane 4c5316931f Fix rescan logic in nodeCtescan.
The previous coding essentially assumed that nodes would be rescanned in
the same order they were initialized in; or at least that the "leader" of
a group of CTEscans would be rescanned before any others were required to
execute.  Unfortunately, that isn't even a little bit true.  It's possible
to devise queries in which the leader isn't rescanned until other CTEscans
on the same CTE have run to completion, or even in which the leader never
gets a rescan call at all.

The fix makes the leader specially responsible only for initial creation
and final destruction of the tuplestore; rescan resets are now a
symmetrically shared responsibility.  This means that we might reset the
tuplestore multiple times when restarting a plan subtree containing
multiple CTEscans; but resetting an already-empty tuplestore is cheap
enough that that doesn't seem like a problem.

Per report from Adam Mackler; the new regression test cases are based on
his example query.

Back-patch to 8.4 where CTE scans were introduced.
2012-08-15 19:02:33 -04:00
..
backend Fix rescan logic in nodeCtescan. 2012-08-15 19:02:33 -04:00
bin Properly escape usernames in initdb, so names with single-quotes are 2012-08-15 11:23:15 -04:00
include More fixes for planner's handling of LATERAL. 2012-08-12 16:01:26 -04:00
interfaces Add runtime checks for number of query parameters passed to libpq functions. 2012-08-13 16:36:35 +03:00
makefiles Remove BSD/OS (BSDi) port. There are no known users upgrading to 2012-05-03 10:58:44 -04:00
pl Add C comment that '=' is not documented for plpgsql assignment. 2012-08-15 12:00:56 -04:00
port Improve reporting of error situations in find_other_exec(). 2012-07-27 19:31:13 -04:00
template Remove BSD/OS (BSDi) port. There are no known users upgrading to 2012-05-03 10:58:44 -04:00
test Fix rescan logic in nodeCtescan. 2012-08-15 19:02:33 -04:00
timezone Update time zone data files to tzdata release 2012e. 2012-08-14 10:54:24 -04:00
tools Adjust pgtest coding to be less complex. 2012-08-10 16:46:02 -04:00
tutorial Update copyright notices for year 2012. 2012-01-01 18:01:58 -05: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 Fix some oversights in distprep and maintainer-clean targets. 2011-03-10 00:04:05 -05:00
Makefile.global.in Make init-po and update-po recursive make targets 2012-06-29 14:01:54 +03:00
Makefile.shlib Remove BSD/OS (BSDi) port. There are no known users upgrading to 2012-05-03 10:58:44 -04:00
bcc32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
nls-global.mk Lots of doc corrections. 2012-04-23 22:43:09 -04:00
win32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00