mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Fix an oversight I made in a cleanup patch over a year ago:
eval_const_expressions needs to be passed the PlannerInfo ("root") structure, because in some cases we want it to substitute values for Param nodes. (So "constant" is not so constant as all that ...) This mistake partially disabled optimization of unnamed extended-Query statements in 8.3: in particular the LIKE-to-indexscan optimization would never be applied if the LIKE pattern was passed as a parameter, and constraint exclusion depending on a parameter value didn't work either.
This commit is contained in:
6
src/backend/utils/cache/relcache.c
vendored
6
src/backend/utils/cache/relcache.c
vendored
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.269 2008/03/26 21:10:39 alvherre Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.270 2008/04/01 00:48:33 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -3068,7 +3068,7 @@ RelationGetIndexExpressions(Relation relation)
|
||||
* them to similarly-processed qual clauses, and may fail to detect valid
|
||||
* matches without this. We don't bother with canonicalize_qual, however.
|
||||
*/
|
||||
result = (List *) eval_const_expressions((Node *) result);
|
||||
result = (List *) eval_const_expressions(NULL, (Node *) result);
|
||||
|
||||
/*
|
||||
* Also mark any coercion format fields as "don't care", so that the
|
||||
@ -3138,7 +3138,7 @@ RelationGetIndexPredicate(Relation relation)
|
||||
* stuff involving subqueries, however, since we don't allow any in index
|
||||
* predicates.)
|
||||
*/
|
||||
result = (List *) eval_const_expressions((Node *) result);
|
||||
result = (List *) eval_const_expressions(NULL, (Node *) result);
|
||||
|
||||
result = (List *) canonicalize_qual((Expr *) result);
|
||||
|
||||
|
Reference in New Issue
Block a user