pgsql: Fix parameter recalculation for Limit nodes: during a ReScan call

Started by Tom Lanealmost 19 years ago3 messageshackers
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

Log Message:
-----------
Fix parameter recalculation for Limit nodes: during a ReScan call we must
recompute the limit/offset immediately, so that the updated values are
available when the child's ReScan function is invoked. Add a regression
test for this, too. Bug is new in HEAD (due to the bounded-sorting patch)
so no need for back-patch.

I did not do anything about merging this signaling with chgParam processing,
but if we were to do that we'd still need to compute the updated values
at this point rather than during the first ProcNode call.

Per observation and test case from Greg Stark, though I didn't use his patch.

Modified Files:
--------------
pgsql/src/backend/executor:
nodeLimit.c (r1.30 -> r1.31)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeLimit.c.diff?r1=1.30&r2=1.31)
nodeSubplan.c (r1.88 -> r1.89)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeSubplan.c.diff?r1=1.88&r2=1.89)
pgsql/src/include/nodes:
execnodes.h (r1.173 -> r1.174)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/execnodes.h.diff?r1=1.173&r2=1.174)
pgsql/src/test/regress/expected:
limit.out (r1.4 -> r1.5)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/limit.out.diff?r1=1.4&r2=1.5)
pgsql/src/test/regress/sql:
limit.sql (r1.4 -> r1.5)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/limit.sql.diff?r1=1.4&r2=1.5)

#2Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#1)
Re: [COMMITTERS] pgsql: Fix parameter recalculation for Limit nodes: during a ReScan call

Is there still a TODO here?

---------------------------------------------------------------------------

Tom Lane wrote:

Log Message:
-----------
Fix parameter recalculation for Limit nodes: during a ReScan call we must
recompute the limit/offset immediately, so that the updated values are
available when the child's ReScan function is invoked. Add a regression
test for this, too. Bug is new in HEAD (due to the bounded-sorting patch)
so no need for back-patch.

I did not do anything about merging this signaling with chgParam processing,
but if we were to do that we'd still need to compute the updated values
at this point rather than during the first ProcNode call.

Per observation and test case from Greg Stark, though I didn't use his patch.

Modified Files:
--------------
pgsql/src/backend/executor:
nodeLimit.c (r1.30 -> r1.31)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeLimit.c.diff?r1=1.30&r2=1.31)
nodeSubplan.c (r1.88 -> r1.89)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeSubplan.c.diff?r1=1.88&r2=1.89)
pgsql/src/include/nodes:
execnodes.h (r1.173 -> r1.174)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/execnodes.h.diff?r1=1.173&r2=1.174)
pgsql/src/test/regress/expected:
limit.out (r1.4 -> r1.5)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/limit.out.diff?r1=1.4&r2=1.5)
pgsql/src/test/regress/sql:
limit.sql (r1.4 -> r1.5)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/limit.sql.diff?r1=1.4&r2=1.5)

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#2)
Re: [COMMITTERS] pgsql: Fix parameter recalculation for Limit nodes: during a ReScan call

Bruce Momjian <bruce@momjian.us> writes:

Is there still a TODO here?

Tom Lane wrote:

Fix parameter recalculation for Limit nodes:

No, it's fixed AFAIK. Till someone finds another bug anyway ;-)

regards, tom lane