From 2b7334d4877ba445003f96b0bb7eed4e7078a39b Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Sat, 20 Jan 2007 18:43:35 +0000 Subject: 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. --- src/backend/access/gist/gistget.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/backend/access/gist/gistget.c') 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)))) -- cgit v1.2.1