|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * IDENTIFICATION
|
10 |
| - * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.5 1996/11/08 00:45:57 scrappy Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.6 1997/01/22 05:26:50 vadim Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
@@ -609,6 +609,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
609 | 609 | Oper *op; /* operator used in scan.. */
|
610 | 610 | Node *leftop; /* expr on lhs of operator */
|
611 | 611 | Node *rightop; /* expr on rhs ... */
|
| 612 | + bits16 flags = 0; |
612 | 613 |
|
613 | 614 | int scanvar; /* which var identifies varattno */
|
614 | 615 | AttrNumber varattno = 0; /* att number used in scan */
|
@@ -675,6 +676,21 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
675 | 676 | */
|
676 | 677 | run_keys[ j ] = NO_OP;
|
677 | 678 | scanvalue = ((Const*) leftop)->constvalue;
|
| 679 | +#ifdef INDEXSCAN_PATCH |
| 680 | + } else if (IsA(leftop,Param)) { |
| 681 | + bool isnull; |
| 682 | + /* ---------------- |
| 683 | + * if the leftop is a Param node then it means |
| 684 | + * it identifies the value to place in our scan key. |
| 685 | + * ---------------- |
| 686 | + */ |
| 687 | + run_keys[ j ] = NO_OP; |
| 688 | + scanvalue = ExecEvalParam((Param*) leftop, |
| 689 | + scanstate->cstate.cs_ExprContext, |
| 690 | + &isnull); |
| 691 | + if ( isnull ) |
| 692 | + flags |= SK_ISNULL; |
| 693 | +#endif |
678 | 694 | } else if (leftop != NULL &&
|
679 | 695 | is_funcclause(leftop) &&
|
680 | 696 | var_is_rel(lfirst(((Expr*)leftop)->args))) {
|
@@ -733,7 +749,21 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
733 | 749 | */
|
734 | 750 | run_keys[ j ] = NO_OP;
|
735 | 751 | scanvalue = ((Const*) rightop)->constvalue;
|
736 |
| - |
| 752 | +#ifdef INDEXSCAN_PATCH |
| 753 | + } else if (IsA(rightop,Param)) { |
| 754 | + bool isnull; |
| 755 | + /* ---------------- |
| 756 | + * if the rightop is a Param node then it means |
| 757 | + * it identifies the value to place in our scan key. |
| 758 | + * ---------------- |
| 759 | + */ |
| 760 | + run_keys[ j ] = NO_OP; |
| 761 | + scanvalue = ExecEvalParam((Param*) rightop, |
| 762 | + scanstate->cstate.cs_ExprContext, |
| 763 | + &isnull); |
| 764 | + if ( isnull ) |
| 765 | + flags |= SK_ISNULL; |
| 766 | +#endif |
737 | 767 | } else if (rightop!=NULL &&
|
738 | 768 | is_funcclause(rightop) &&
|
739 | 769 | var_is_rel(lfirst(((Expr*)rightop)->args))) {
|
@@ -777,7 +807,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
777 | 807 | * ----------------
|
778 | 808 | */
|
779 | 809 | ScanKeyEntryInitialize(&scan_keys[j],
|
780 |
| - 0, |
| 810 | + flags, |
781 | 811 | varattno, /* attribute number to scan */
|
782 | 812 | (RegProcedure) opid, /* reg proc to use */
|
783 | 813 | (Datum) scanvalue); /* constant */
|
|
0 commit comments