diff options
author | Neil Conway <neilc@samurai.com> | 2007-01-20 18:43:35 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2007-01-20 18:43:35 +0000 |
commit | 2b7334d4877ba445003f96b0bb7eed4e7078a39b (patch) | |
tree | 6828dfd02c4f2c20ee2d3c56d1e8f1242887c162 /src/backend/access/gist/gistget.c | |
parent | 978fff79421ec1c36a1ec58092f1167ce22319b9 (diff) | |
download | postgresql-2b7334d4877ba445003f96b0bb7eed4e7078a39b.tar.gz |
Refactor the index AM API slightly: move currentItemData and
currentMarkData from IndexScanDesc to the opaque structs for the
AMs that need this information (currently gist and hash).
Patch from Heikki Linnakangas, fixes by Neil Conway.
Diffstat (limited to 'src/backend/access/gist/gistget.c')
-rw-r--r-- | src/backend/access/gist/gistget.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c index f36653babd..f1d2c777c2 100644 --- a/src/backend/access/gist/gistget.c +++ b/src/backend/access/gist/gistget.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.63 2007/01/05 22:19:22 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.64 2007/01/20 18:43:35 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -106,8 +106,8 @@ gistgettuple(PG_FUNCTION_ARGS) * If we have produced an index tuple in the past and the executor has * informed us we need to mark it as "killed", do so now. */ - if (scan->kill_prior_tuple && ItemPointerIsValid(&(scan->currentItemData))) - killtuple(scan->indexRelation, so, &(scan->currentItemData)); + if (scan->kill_prior_tuple && ItemPointerIsValid(&(so->curpos))) + killtuple(scan->indexRelation, so, &(so->curpos)); /* * Get the next tuple that matches the search key. If asked to skip killed @@ -138,7 +138,8 @@ gistgetmulti(PG_FUNCTION_ARGS) * tuples. Returns true iff a matching tuple was found. */ static int -gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, bool ignore_killed_tuples) +gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, + int maxtids, bool ignore_killed_tuples) { Page p; OffsetNumber n; @@ -151,7 +152,7 @@ gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, b so = (GISTScanOpaque) scan->opaque; - if (ItemPointerIsValid(&scan->currentItemData) == false) + if (ItemPointerIsValid(&so->curpos) == false) { /* Being asked to fetch the first entry, so start at the root */ Assert(so->curbuf == InvalidBuffer); @@ -226,7 +227,7 @@ gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, b } if (!GistPageIsLeaf(p) || resetoffset || - !ItemPointerIsValid(&scan->currentItemData)) + !ItemPointerIsValid(&so->curpos)) { if (ScanDirectionIsBackward(dir)) n = PageGetMaxOffsetNumber(p); @@ -235,7 +236,7 @@ gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, b } else { - n = ItemPointerGetOffsetNumber(&(scan->currentItemData)); + n = ItemPointerGetOffsetNumber(&(so->curpos)); if (ScanDirectionIsBackward(dir)) n = OffsetNumberPrev(n); @@ -285,7 +286,7 @@ gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, b * we can efficiently resume the index scan later. */ - ItemPointerSet(&(scan->currentItemData), + ItemPointerSet(&(so->curpos), BufferGetBlockNumber(so->curbuf), n); if (!(ignore_killed_tuples && ItemIdDeleted(PageGetItemId(p, n)))) |