diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-11-12 21:15:59 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-11-12 21:15:59 +0000 |
commit | fa5c8a055a02e44f446e4593e397c33a572c4d67 (patch) | |
tree | 9c0a7ded5a88c082c28dbe2b431660813abd72b8 /src/backend/executor/nodeIndexscan.c | |
parent | 49f98fa833407b4e4252e42522e640ec8a0d08b2 (diff) |
Cross-data-type comparisons are now indexable by btrees, pursuant to my
pghackers proposal of 8-Nov. All the existing cross-type comparison
operators (int2/int4/int8 and float4/float8) have appropriate support.
The original proposal of storing the right-hand-side datatype as part of
the primary key for pg_amop and pg_amproc got modified a bit in the event;
it is easier to store zero as the 'default' case and only store a nonzero
when the operator is actually cross-type. Along the way, remove the
long-since-defunct bigbox_ops operator class.
Diffstat (limited to 'src/backend/executor/nodeIndexscan.c')
-rw-r--r-- | src/backend/executor/nodeIndexscan.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c index 54114ad9245..98158a00c9c 100644 --- a/src/backend/executor/nodeIndexscan.c +++ b/src/backend/executor/nodeIndexscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.85 2003/11/09 21:30:36 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.86 2003/11/12 21:15:52 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -31,7 +31,6 @@ #include "miscadmin.h" #include "nodes/nodeFuncs.h" #include "optimizer/clauses.h" -#include "parser/parse_expr.h" #include "parser/parsetree.h" @@ -615,6 +614,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate) IndexScanState *indexstate; List *indxqual; List *indxstrategy; + List *indxsubtype; List *indxid; int i; int numIndices; @@ -711,10 +711,12 @@ ExecInitIndexScan(IndexScan *node, EState *estate) */ indxqual = node->indxqual; indxstrategy = node->indxstrategy; + indxsubtype = node->indxsubtype; for (i = 0; i < numIndices; i++) { List *quals; List *strategies; + List *subtypes; int n_keys; ScanKey scan_keys; ExprState **run_keys; @@ -724,6 +726,8 @@ ExecInitIndexScan(IndexScan *node, EState *estate) indxqual = lnext(indxqual); strategies = lfirst(indxstrategy); indxstrategy = lnext(indxstrategy); + subtypes = lfirst(indxsubtype); + indxsubtype = lnext(indxsubtype); n_keys = length(quals); scan_keys = (n_keys <= 0) ? (ScanKey) NULL : (ScanKey) palloc(n_keys * sizeof(ScanKeyData)); @@ -742,9 +746,9 @@ ExecInitIndexScan(IndexScan *node, EState *estate) int flags = 0; AttrNumber varattno; /* att number used in scan */ StrategyNumber strategy; /* op's strategy number */ + Oid subtype; /* op's strategy subtype */ RegProcedure opfuncid; /* operator proc id used in scan */ Datum scanvalue; /* value used in scan (if const) */ - Oid rhstype; /* datatype of comparison value */ /* * extract clause information from the qualification @@ -753,6 +757,8 @@ ExecInitIndexScan(IndexScan *node, EState *estate) quals = lnext(quals); strategy = lfirsti(strategies); strategies = lnext(strategies); + subtype = lfirsto(subtypes); + subtypes = lnext(subtypes); if (!IsA(clause, OpExpr)) elog(ERROR, "indxqual is not an OpExpr"); @@ -795,8 +801,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate) */ rightop = (Expr *) get_rightop((Expr *) clause); - rhstype = exprType((Node *) rightop); - if (rightop && IsA(rightop, RelabelType)) rightop = ((RelabelType *) rightop)->arg; @@ -832,9 +836,9 @@ ExecInitIndexScan(IndexScan *node, EState *estate) varattno, /* attribute number to * scan */ strategy, /* op's strategy */ + subtype, /* strategy subtype */ opfuncid, /* reg proc to use */ - scanvalue, /* constant */ - rhstype); /* constant's type */ + scanvalue); /* constant */ } /* |