1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Do honest transformation and preprocessing of LIMIT/OFFSET clauses,

instead of the former kluge whereby gram.y emitted already-transformed
expressions.  This is needed so that Params appearing in these clauses
actually work correctly.  I suppose some might claim that the side effect
of 'SELECT ... LIMIT 2+2' working is a new feature, but I say this is
a bug fix.
This commit is contained in:
Tom Lane
2003-07-03 19:07:54 +00:00
parent 455891bf96
commit b89140a7ec
8 changed files with 150 additions and 86 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.155 2003/06/16 02:03:37 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.156 2003/07/03 19:07:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -47,7 +47,8 @@
#define EXPRKIND_QUAL 0
#define EXPRKIND_TARGET 1
#define EXPRKIND_RTFUNC 2
#define EXPRKIND_ININFO 3
#define EXPRKIND_LIMIT 3
#define EXPRKIND_ININFO 4
static Node *preprocess_expression(Query *parse, Node *expr, int kind);
@ -232,6 +233,11 @@ subquery_planner(Query *parse, double tuple_fraction)
parse->havingQual = preprocess_expression(parse, parse->havingQual,
EXPRKIND_QUAL);
parse->limitOffset = preprocess_expression(parse, parse->limitOffset,
EXPRKIND_LIMIT);
parse->limitCount = preprocess_expression(parse, parse->limitCount,
EXPRKIND_LIMIT);
parse->in_info_list = (List *)
preprocess_expression(parse, (Node *) parse->in_info_list,
EXPRKIND_ININFO);