diff options
author | Teodor Sigaev <teodor@sigaev.ru> | 2008-10-22 12:55:59 +0000 |
---|---|---|
committer | Teodor Sigaev <teodor@sigaev.ru> | 2008-10-22 12:55:59 +0000 |
commit | 8a47932c3ea47f1dce8df10dfc424a199ada9110 (patch) | |
tree | d6654ca2fe4dac52264b4c66eabdf79cca6f3f55 /src/backend/access/gist/gistget.c | |
parent | f189a122265a964cdd7f5ce44447afb9f45f1aa0 (diff) | |
download | postgresql-8a47932c3ea47f1dce8df10dfc424a199ada9110.tar.gz postgresql-8a47932c3ea47f1dce8df10dfc424a199ada9110.zip |
Fix GiST's killing tuple: GISTScanOpaque->curpos wasn't
correctly set. As result, killtuple() marks as dead
wrong tuple on page. Bug was introduced by me while fixing
possible duplicates during GiST index scan.
Diffstat (limited to 'src/backend/access/gist/gistget.c')
-rw-r--r-- | src/backend/access/gist/gistget.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c index ebc41185cbc..ea4d06c232d 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.62.2.1 2008/08/23 10:41:38 teodor Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.62.2.2 2008/10/22 12:55:59 teodor Exp $ * *------------------------------------------------------------------------- */ @@ -153,7 +153,11 @@ gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, b { while( ntids < maxtids && so->curPageData < so->nPageData ) { - tids[ ntids ] = scan->xs_ctup.t_self = so->pageData[ so->curPageData ]; + tids[ ntids ] = scan->xs_ctup.t_self = so->pageData[ so->curPageData ].heapPtr; + ItemPointerSet(&scan->currentItemData, + BufferGetBlockNumber(so->curbuf), + so->pageData[ so->curPageData ].pageOffset); + so->curPageData ++; ntids++; @@ -247,8 +251,13 @@ gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, b { while( ntids < maxtids && so->curPageData < so->nPageData ) { - tids[ ntids ] = scan->xs_ctup.t_self = so->pageData[ so->curPageData ]; + tids[ ntids ] = scan->xs_ctup.t_self = + so->pageData[ so->curPageData ].heapPtr; + ItemPointerSet(&scan->currentItemData, + BufferGetBlockNumber(so->curbuf), + so->pageData[ so->curPageData ].pageOffset); + so->curPageData ++; ntids++; } @@ -293,13 +302,11 @@ gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, b * we can efficiently resume the index scan later. */ - ItemPointerSet(&(scan->currentItemData), - BufferGetBlockNumber(so->curbuf), n); - if (!(ignore_killed_tuples && ItemIdDeleted(PageGetItemId(p, n)))) { it = (IndexTuple) PageGetItem(p, PageGetItemId(p, n)); - so->pageData[ so->nPageData ] = it->t_tid; + so->pageData[ so->nPageData ].heapPtr = it->t_tid; + so->pageData[ so->nPageData ].pageOffset = n; so->nPageData ++; } } |