diff options
Diffstat (limited to 'src/backend')
| -rw-r--r-- | src/backend/access/gist/gist.c | 9 | ||||
| -rw-r--r-- | src/backend/access/gist/gistget.c | 6 | ||||
| -rw-r--r-- | src/backend/access/gist/gistscan.c | 8 | ||||
| -rw-r--r-- | src/backend/access/gist/giststrat.c | 15 | ||||
| -rw-r--r-- | src/backend/access/hash/hashstrat.c | 24 | ||||
| -rw-r--r-- | src/backend/access/index/istrat.c | 35 | ||||
| -rw-r--r-- | src/backend/access/nbtree/nbtstrat.c | 32 | ||||
| -rw-r--r-- | src/backend/access/rtree/rtstrat.c | 29 |
8 files changed, 82 insertions, 76 deletions
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 4b239c76c8..8f23d14d79 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -4,13 +4,14 @@ * interface routines for the postgres GiST index access method. * * + * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.76 2001/05/15 14:14:49 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.77 2001/05/30 19:53:39 tgl Exp $ * *------------------------------------------------------------------------- */ - #include "postgres.h" #include "access/genam.h" @@ -22,9 +23,9 @@ #include "executor/executor.h" #include "miscadmin.h" #include "utils/syscache.h" - #include "access/xlogutils.h" + /* result's status */ #define INSERTED 0x01 #define SPLITED 0x02 @@ -78,9 +79,9 @@ static void gistcentryinit(GISTSTATE *giststate, OffsetNumber o, int b, bool l); #undef GISTDEBUG + #ifdef GISTDEBUG static void gist_dumptree(Relation r, int level, BlockNumber blk, OffsetNumber coff); - #endif /* diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c index d6fac6f4e2..f922da750d 100644 --- a/src/backend/access/gist/gistget.c +++ b/src/backend/access/gist/gistget.c @@ -4,20 +4,20 @@ * fetch tuples from a GiST scan. * * + * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * /usr/local/devel/pglite/cvs/src/backend/access/gisr/gistget.c,v 1.9.1 1996/11/21 01:00:00 vadim Exp + * $Header: /cvsroot/pgsql/src/backend/access/gist/gistget.c,v 1.27 2001/05/30 19:53:40 tgl Exp $ * *------------------------------------------------------------------------- */ - #include "postgres.h" #include "access/gist.h" #include "executor/execdebug.h" - static OffsetNumber gistfindnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir); static RetrieveIndexResult gistscancache(IndexScanDesc s, ScanDirection dir); diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c index ea6114033e..bcabd6caf2 100644 --- a/src/backend/access/gist/gistscan.c +++ b/src/backend/access/gist/gistscan.c @@ -1,15 +1,17 @@ /*------------------------------------------------------------------------- * * gistscan.c - * routines to manage scans on index relations + * routines to manage scans on GiST index relations * * + * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * * IDENTIFICATION - * /usr/local/devel/pglite/cvs/src/backend/access/gist/gistscan.c,v 1.7 1995/06/14 00:10:05 jolly Exp + * $Header: /cvsroot/pgsql/src/backend/access/gist/gistscan.c,v 1.34 2001/05/30 19:53:40 tgl Exp $ * *------------------------------------------------------------------------- */ - #include "postgres.h" #include "access/genam.h" diff --git a/src/backend/access/gist/giststrat.c b/src/backend/access/gist/giststrat.c index 31ef31dedf..e0bae48a3c 100644 --- a/src/backend/access/gist/giststrat.c +++ b/src/backend/access/gist/giststrat.c @@ -3,21 +3,21 @@ * giststrat.c * strategy map data for GiSTs. * + * * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * * IDENTIFICATION - * /usr/local/devel/pglite/cvs/src/backend/access/gist/giststrat.c,v 1.4 1995/06/14 00:10:05 jolly Exp + * $Header: /cvsroot/pgsql/src/backend/access/gist/Attic/giststrat.c,v 1.17 2001/05/30 19:53:40 tgl Exp $ * *------------------------------------------------------------------------- */ - #include "postgres.h" #include "access/gist.h" #include "access/istrat.h" + /* * Note: negate, commute, and negatecommute all assume that operators are * ordered as follows in the strategy map: @@ -71,6 +71,12 @@ static StrategyNumber GISTNegateCommute[GISTNStrategies] = { * TermData) -- such logic must be encoded in the user's Consistent function. */ +static StrategyExpression GISTEvaluationExpressions[GISTNStrategies] = { + NULL, + NULL, + NULL +}; + /* * If you were sufficiently attentive to detail, you would go through * the ExpressionData pain above for every one of the strategies @@ -92,9 +98,10 @@ static StrategyEvaluationData GISTEvaluationData = { (StrategyTransformMap) GISTNegate, /* how to do (not qual) */ (StrategyTransformMap) GISTCommute, /* how to swap operands */ (StrategyTransformMap) GISTNegateCommute, /* how to do both */ - {NULL} + GISTEvaluationExpressions }; + StrategyNumber RelationGetGISTStrategy(Relation r, AttrNumber attnum, diff --git a/src/backend/access/hash/hashstrat.c b/src/backend/access/hash/hashstrat.c index a423e720c8..fc5df2372d 100644 --- a/src/backend/access/hash/hashstrat.c +++ b/src/backend/access/hash/hashstrat.c @@ -1,46 +1,50 @@ /*------------------------------------------------------------------------- * - * btstrat.c - * Srategy map entries for the btree indexed access method + * hashstrat.c + * Srategy map entries for the hash indexed access method * * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/hash/Attic/hashstrat.c,v 1.17 2001/01/24 19:42:47 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/hash/Attic/hashstrat.c,v 1.18 2001/05/30 19:53:40 tgl Exp $ * *------------------------------------------------------------------------- */ - #include "postgres.h" +#include "access/hash.h" + /* * only one valid strategy for hash tables: equality. */ #ifdef NOT_USED -static StrategyNumber HTNegate[1] = { + +static StrategyNumber HTNegate[HTMaxStrategyNumber] = { InvalidStrategy }; -static StrategyNumber HTCommute[1] = { +static StrategyNumber HTCommute[HTMaxStrategyNumber] = { HTEqualStrategyNumber }; -static StrategyNumber HTNegateCommute[1] = { +static StrategyNumber HTNegateCommute[HTMaxStrategyNumber] = { InvalidStrategy }; -static StrategyEvaluationData HTEvaluationData = { - /* XXX static for simplicity */ +static StrategyExpression HTEvaluationExpressions[HTMaxStrategyNumber] = { + NULL +}; +static StrategyEvaluationData HTEvaluationData = { HTMaxStrategyNumber, (StrategyTransformMap) HTNegate, (StrategyTransformMap) HTCommute, (StrategyTransformMap) HTNegateCommute, - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} + HTEvaluationExpressions }; #endif diff --git a/src/backend/access/index/istrat.c b/src/backend/access/index/istrat.c index 3b01639206..8cd1284972 100644 --- a/src/backend/access/index/istrat.c +++ b/src/backend/access/index/istrat.c @@ -9,11 +9,10 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.49 2001/03/22 03:59:13 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.50 2001/05/30 19:53:40 tgl Exp $ * *------------------------------------------------------------------------- */ - #include "postgres.h" #include "access/heapam.h" @@ -37,7 +36,6 @@ static bool StrategyOperatorIsValid(StrategyOperator operator, StrategyNumber maxStrategy); static bool StrategyTermIsValid(StrategyTerm term, StrategyNumber maxStrategy); - #endif @@ -188,19 +186,13 @@ StrategyEvaluationIsValid(StrategyEvaluation evaluation) !StrategyTransformMapIsValid(evaluation->negateTransform) || !StrategyTransformMapIsValid(evaluation->commuteTransform) || !StrategyTransformMapIsValid(evaluation->negateCommuteTransform)) - { - return false; - } for (index = 0; index < evaluation->maxStrategy; index += 1) { if (!StrategyExpressionIsValid(evaluation->expression[index], evaluation->maxStrategy)) - { - return false; - } } return true; } @@ -268,6 +260,8 @@ StrategyTermEvaluate(StrategyTerm term, /* ---------------- * RelationGetStrategy + * + * Identify strategy number that describes given procedure, if there is one. * ---------------- */ StrategyNumber @@ -286,8 +280,7 @@ RelationGetStrategy(Relation relation, numattrs = RelationGetNumberOfAttributes(relation); Assert(relation->rd_rel->relkind == RELKIND_INDEX); /* XXX use accessor */ - Assert(AttributeNumberIsValid(attributeNumber)); - Assert((attributeNumber >= 1) && (attributeNumber < 1 + numattrs)); + Assert((attributeNumber >= 1) && (attributeNumber <= numattrs)); Assert(StrategyEvaluationIsValid(evaluation)); Assert(RegProcedureIsValid(procedure)); @@ -332,7 +325,6 @@ RelationGetStrategy(Relation relation, elog(FATAL, "RelationGetStrategy: impossible case %d", entry->sk_flags); } - if (!StrategyNumberIsInBounds(strategy, evaluation->maxStrategy)) { if (!StrategyNumberIsValid(strategy)) @@ -391,7 +383,6 @@ RelationInvokeStrategy(Relation relation, newStrategy = evaluation->negateTransform->strategy[strategy - 1]; if (newStrategy != strategy && StrategyNumberIsValid(newStrategy)) { - entry = StrategyMapGetScanKeyEntry(strategyMap, newStrategy); if (RegProcedureIsValid(entry->sk_procedure)) @@ -406,7 +397,6 @@ RelationInvokeStrategy(Relation relation, newStrategy = evaluation->commuteTransform->strategy[strategy - 1]; if (newStrategy != strategy && StrategyNumberIsValid(newStrategy)) { - entry = StrategyMapGetScanKeyEntry(strategyMap, newStrategy); if (RegProcedureIsValid(entry->sk_procedure)) @@ -421,7 +411,6 @@ RelationInvokeStrategy(Relation relation, newStrategy = evaluation->negateCommuteTransform->strategy[strategy - 1]; if (newStrategy != strategy && StrategyNumberIsValid(newStrategy)) { - entry = StrategyMapGetScanKeyEntry(strategyMap, newStrategy); if (RegProcedureIsValid(entry->sk_procedure)) @@ -463,8 +452,6 @@ RelationInvokeStrategy(Relation relation, /* not reached, just to make compiler happy */ return FALSE; - - } #endif @@ -614,16 +601,16 @@ IndexSupportInitialize(IndexStrategy indexStrategy, ObjectIdGetDatum(accessMethodObjectId)); ScanKeyEntryInitialize(&entry[1], 0, Anum_pg_amproc_amopclaid, - F_OIDEQ, 0); + F_OIDEQ, + InvalidOid); /* will set below */ relation = heap_openr(AccessMethodProcedureRelationName, AccessShareLock); for (attNumber = 1; attNumber <= maxAttributeNumber; attNumber++) { - int16 support; - Form_pg_amproc aform; RegProcedure *loc; + StrategyNumber support; loc = &indexSupport[((attNumber - 1) * maxSupportNumber)]; @@ -637,8 +624,12 @@ IndexSupportInitialize(IndexStrategy indexStrategy, while (HeapTupleIsValid(tuple = heap_getnext(scan, 0))) { + Form_pg_amproc aform; + aform = (Form_pg_amproc) GETSTRUCT(tuple); - loc[(aform->amprocnum - 1)] = aform->amproc; + support = aform->amprocnum; + Assert(support > 0 && support <= maxSupportNumber); + loc[support - 1] = aform->amproc; } heap_endscan(scan); @@ -708,7 +699,6 @@ IndexStrategyDisplay(IndexStrategy indexStrategy, for (attributeNumber = 1; attributeNumber <= numberOfAttributes; attributeNumber += 1) { - strategyMap = IndexStrategyGetStrategyMap(indexStrategy, numberOfStrategies, attributeNumber); @@ -717,7 +707,6 @@ IndexStrategyDisplay(IndexStrategy indexStrategy, strategyNumber <= AMStrategies(numberOfStrategies); strategyNumber += 1) { - printf(":att %d\t:str %d\t:opr 0x%x(%d)\n", attributeNumber, strategyNumber, strategyMap->entry[strategyNumber - 1].sk_procedure, diff --git a/src/backend/access/nbtree/nbtstrat.c b/src/backend/access/nbtree/nbtstrat.c index ba4850dc78..4045496979 100644 --- a/src/backend/access/nbtree/nbtstrat.c +++ b/src/backend/access/nbtree/nbtstrat.c @@ -1,14 +1,14 @@ /*------------------------------------------------------------------------- * - * btstrat.c - * Srategy map entries for the btree indexed access method + * nbtstrat.c + * Strategy map entries for the btree indexed access method * * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtstrat.c,v 1.13 2001/01/24 19:42:49 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtstrat.c,v 1.14 2001/05/30 19:53:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -23,7 +23,7 @@ * StrategyNegate, StrategyCommute, and StrategyNegateCommute * assume <, <=, ==, >=, > ordering. */ -static StrategyNumber BTNegate[5] = { +static StrategyNumber BTNegate[BTMaxStrategyNumber] = { BTGreaterEqualStrategyNumber, BTGreaterStrategyNumber, InvalidStrategy, @@ -31,7 +31,7 @@ static StrategyNumber BTNegate[5] = { BTLessEqualStrategyNumber }; -static StrategyNumber BTCommute[5] = { +static StrategyNumber BTCommute[BTMaxStrategyNumber] = { BTGreaterStrategyNumber, BTGreaterEqualStrategyNumber, InvalidStrategy, @@ -39,7 +39,7 @@ static StrategyNumber BTCommute[5] = { BTLessStrategyNumber }; -static StrategyNumber BTNegateCommute[5] = { +static StrategyNumber BTNegateCommute[BTMaxStrategyNumber] = { BTLessEqualStrategyNumber, BTLessStrategyNumber, InvalidStrategy, @@ -87,16 +87,20 @@ static StrategyTerm BTEqualExpressionData[] = { NULL }; -static StrategyEvaluationData BTEvaluationData = { - /* XXX static for simplicity */ +static StrategyExpression BTEvaluationExpressions[BTMaxStrategyNumber] = { + NULL, + NULL, + (StrategyExpression) BTEqualExpressionData, + NULL, + NULL +}; +static StrategyEvaluationData BTEvaluationData = { BTMaxStrategyNumber, - (StrategyTransformMap) BTNegate, /* XXX */ - (StrategyTransformMap) BTCommute, /* XXX */ - (StrategyTransformMap) BTNegateCommute, /* XXX */ - - {NULL, NULL, (StrategyExpression) BTEqualExpressionData, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL} + (StrategyTransformMap) BTNegate, + (StrategyTransformMap) BTCommute, + (StrategyTransformMap) BTNegateCommute, + BTEvaluationExpressions }; /* ---------------------------------------------------------------- diff --git a/src/backend/access/rtree/rtstrat.c b/src/backend/access/rtree/rtstrat.c index e176b064f9..74ee6a39a4 100644 --- a/src/backend/access/rtree/rtstrat.c +++ b/src/backend/access/rtree/rtstrat.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtstrat.c,v 1.16 2001/01/24 19:42:50 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtstrat.c,v 1.17 2001/05/30 19:53:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -96,7 +96,7 @@ static StrategyNumber RTNegateCommute[RTNStrategies] = { * Early in the development of the POSTGRES access methods, it was believed * that writing functions was harder than writing arrays. This is wrong; * TermData is hard to understand and hard to get right. In general, when - * someone populates a new operator class, the populate it completely. If + * someone populates a new operator class, they populate it completely. If * Mike Hirohama had forced Cimarron Taylor to populate the strategy map * for btree int2_ops completely in 1988, you wouldn't have to deal with * all this now. Too bad for you. @@ -157,24 +157,23 @@ static StrategyTerm RTEqualExpressionData[] = { * in the access methods just isn't worth the trouble, though. */ +static StrategyExpression RTEvaluationExpressions[RTNStrategies] = { + NULL, /* express left */ + NULL, /* express overleft */ + NULL, /* express overlap */ + NULL, /* express overright */ + NULL, /* express right */ + (StrategyExpression) RTEqualExpressionData, /* express same */ + NULL, /* express contains */ + NULL /* express contained-by */ +}; + static StrategyEvaluationData RTEvaluationData = { RTNStrategies, /* # of strategies */ (StrategyTransformMap) RTNegate, /* how to do (not qual) */ (StrategyTransformMap) RTCommute, /* how to swap operands */ (StrategyTransformMap) RTNegateCommute, /* how to do both */ - { - NULL, /* express left */ - NULL, /* express overleft */ - NULL, /* express over */ - NULL, /* express overright */ - NULL, /* express right */ - (StrategyExpression) RTEqualExpressionData, /* express same */ - NULL, /* express contains */ - NULL, /* express contained-by */ - NULL, - NULL, - NULL - } + RTEvaluationExpressions }; /* |
