|
7 | 7 | * |
8 | 8 | * |
9 | 9 | * IDENTIFICATION |
10 | | - * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.11 1997/09/08 21:45:47 momjian Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.12 1997/09/25 12:48:15 vadim Exp $ |
11 | 11 | * |
12 | 12 | * HISTORY |
13 | 13 | * AUTHORDATEMAJOR EVENT |
@@ -641,30 +641,20 @@ get_relattval(Node *clause, |
641 | 641 | is_funcclause((Node*)left)&& |
642 | 642 | IsA(right,Const)) |
643 | 643 | { |
644 | | -List*args= ((Expr*)left)->args; |
645 | | - |
646 | | - |
647 | | -*relid= ((Var*)lfirst(args))->varno; |
| 644 | +List*vars=pull_var_clause((Node*)left); |
| 645 | + |
| 646 | +*relid= ((Var*)lfirst(vars))->varno; |
648 | 647 | *attno=InvalidAttrNumber; |
649 | 648 | *constval= ((Const*)right)->constvalue; |
650 | 649 | *flag= (_SELEC_CONSTANT_RIGHT_ |_SELEC_IS_CONSTANT_); |
651 | | - |
652 | | -/* |
653 | | - * XXX both of these func clause handling if's seem wrong to me. |
654 | | - * they assume that the first argument is the Var.It could not |
655 | | - * handle (for example) f(1, emp.name). I think I may have been |
656 | | - * assuming no constants in functional index scans when I |
657 | | - * implemented this originally (still currently true). -mer 10 Aug |
658 | | - * 1992 |
659 | | - */ |
660 | 650 | } |
661 | 651 | elseif (is_opclause(clause)&& |
662 | 652 | is_funcclause((Node*)right)&& |
663 | 653 | IsA(left,Const)) |
664 | 654 | { |
665 | | -List*args=((Expr*)right)->args; |
666 | | - |
667 | | -*relid= ((Var*)lfirst(args))->varno; |
| 655 | +List*vars=pull_var_clause((Node*)right); |
| 656 | +
|
| 657 | +*relid= ((Var*)lfirst(vars))->varno; |
668 | 658 | *attno=InvalidAttrNumber; |
669 | 659 | *constval= ((Const*)left)->constvalue; |
670 | 660 | *flag= (_SELEC_IS_CONSTANT_); |
|