mirror of
https://github.com/postgres/postgres.git
synced 2025-05-12 16:21:30 +03:00
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
|
* 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
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
@ -641,30 +641,20 @@ get_relattval(Node *clause,
|
|||||||
is_funcclause((Node *) left) &&
|
is_funcclause((Node *) left) &&
|
||||||
IsA(right, Const))
|
IsA(right, Const))
|
||||||
{
|
{
|
||||||
List *args = ((Expr *) left)->args;
|
List *vars = pull_var_clause((Node*)left);
|
||||||
|
|
||||||
|
*relid = ((Var *) lfirst(vars))->varno;
|
||||||
*relid = ((Var *) lfirst(args))->varno;
|
|
||||||
*attno = InvalidAttrNumber;
|
*attno = InvalidAttrNumber;
|
||||||
*constval = ((Const *) right)->constvalue;
|
*constval = ((Const *) right)->constvalue;
|
||||||
*flag = (_SELEC_CONSTANT_RIGHT_ | _SELEC_IS_CONSTANT_);
|
*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) &&
|
else if (is_opclause(clause) &&
|
||||||
is_funcclause((Node *) right) &&
|
is_funcclause((Node *) right) &&
|
||||||
IsA(left, Const))
|
IsA(left, Const))
|
||||||
{
|
{
|
||||||
List *args = ((Expr *) right)->args;
|
List *vars = pull_var_clause((Node*)right);
|
||||||
|
|
||||||
*relid = ((Var *) lfirst(args))->varno;
|
*relid = ((Var *) lfirst(vars))->varno;
|
||||||
*attno = InvalidAttrNumber;
|
*attno = InvalidAttrNumber;
|
||||||
*constval = ((Const *) left)->constvalue;
|
*constval = ((Const *) left)->constvalue;
|
||||||
*flag = (_SELEC_IS_CONSTANT_);
|
*flag = (_SELEC_IS_CONSTANT_);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user