Fix handling of functions with non-attribute first argument in WHERE
clauses.
This commit is contained in:
parent
c42f7f1460
commit
6be30fb524
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.11 1997/09/08 21:45:47 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.12 1997/09/25 12:48:15 vadim Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@ -641,30 +641,20 @@ get_relattval(Node *clause,
|
||||
is_funcclause((Node *) left) &&
|
||||
IsA(right, Const))
|
||||
{
|
||||
List *args = ((Expr *) left)->args;
|
||||
|
||||
|
||||
*relid = ((Var *) lfirst(args))->varno;
|
||||
List *vars = pull_var_clause((Node*)left);
|
||||
|
||||
*relid = ((Var *) lfirst(vars))->varno;
|
||||
*attno = InvalidAttrNumber;
|
||||
*constval = ((Const *) right)->constvalue;
|
||||
*flag = (_SELEC_CONSTANT_RIGHT_ | _SELEC_IS_CONSTANT_);
|
||||
|
||||
/*
|
||||
* XXX both of these func clause handling if's seem wrong to me.
|
||||
* they assume that the first argument is the Var. It could not
|
||||
* handle (for example) f(1, emp.name). I think I may have been
|
||||
* assuming no constants in functional index scans when I
|
||||
* implemented this originally (still currently true). -mer 10 Aug
|
||||
* 1992
|
||||
*/
|
||||
}
|
||||
else if (is_opclause(clause) &&
|
||||
is_funcclause((Node *) right) &&
|
||||
IsA(left, Const))
|
||||
{
|
||||
List *args = ((Expr *) right)->args;
|
||||
|
||||
*relid = ((Var *) lfirst(args))->varno;
|
||||
List *vars = pull_var_clause((Node*)right);
|
||||
|
||||
*relid = ((Var *) lfirst(vars))->varno;
|
||||
*attno = InvalidAttrNumber;
|
||||
*constval = ((Const *) left)->constvalue;
|
||||
*flag = (_SELEC_IS_CONSTANT_);
|
||||
|
Loading…
x
Reference in New Issue
Block a user