From fc8d970cbcdd6f025475822a4cf01dfda0873226 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 28 May 2003 16:04:02 +0000 Subject: Replace functional-index facility with expressional indexes. Any column of an index can now be a computed expression instead of a simple variable. Restrictions on expressions are the same as for predicates (only immutable functions, no sub-selects). This fixes problems recently introduced with inlining SQL functions, because the inlining transformation is applied to both expression trees so the planner can still match them up. Along the way, improve efficiency of handling index predicates (both predicates and index expressions are now cached by the relcache) and fix 7.3 oversight that didn't record dependencies of predicate expressions. --- src/backend/executor/execUtils.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/backend/executor') diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index c06d951f91e..ca4ff192f44 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.99 2003/05/05 17:57:47 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.100 2003/05/28 16:03:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -706,10 +706,8 @@ ExecOpenIndices(ResultRelInfo *resultRelInfo) if (!indexDesc->rd_am->amconcurrent) LockRelation(indexDesc, AccessExclusiveLock); - /* - * extract index key information from the index's pg_index tuple - */ - ii = BuildIndexInfo(indexDesc->rd_index); + /* extract index key information from the index's pg_index info */ + ii = BuildIndexInfo(indexDesc); relationDescs[i] = indexDesc; indexInfoArray[i] = ii; @@ -797,7 +795,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot, /* * We will use the EState's per-tuple context for evaluating - * predicates and functional-index functions (creating it if it's not + * predicates and index expressions (creating it if it's not * already there). */ econtext = GetPerTupleExprContext(estate); @@ -844,11 +842,12 @@ ExecInsertIndexTuples(TupleTableSlot *slot, /* * FormIndexDatum fills in its datum and null parameters with * attribute information taken from the given heap tuple. + * It also computes any expressions needed. */ FormIndexDatum(indexInfo, heapTuple, heapDescriptor, - econtext->ecxt_per_tuple_memory, + estate, datum, nullv); -- cgit v1.2.3