Fix up LIMIT/OFFSET planning so that we cope with non-constant LIMIT
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 18 Aug 2005 17:51:12 +0000 (17:51 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 18 Aug 2005 17:51:12 +0000 (17:51 +0000)
commitc62bb2b2a29008a2e8d6f1087bb3bd1c00ebdd7b
treef14fb7d379973afff53dab15dc7023f79db51f95
parentb12e9b5ffcefbbb1c5d017cad2b30a0f479e0fca
Fix up LIMIT/OFFSET planning so that we cope with non-constant LIMIT
or OFFSET clauses by using estimate_expression_value().  The main advantage
of this is that if the expression is a Param and we have a value for the
Param, we'll use that value rather than defaulting.  Also, fix some
thinkos in the logic for combining LIMIT/OFFSET with an externally
supplied tuple fraction (this covers cases like EXISTS(...LIMIT...)).
And make sure the results of all this are shown by EXPLAIN.  Per a
gripe from Merlin Moncure.
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/planagg.c
src/backend/optimizer/plan/planner.c
src/include/optimizer/planmain.h