diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-06-06 02:39:40 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-06-06 02:39:40 +0000 |
commit | 356eea24ce6f5e0875b85e938230cfd01ed75ae3 (patch) | |
tree | 36d3e14da16b0ef91998fda4587b750308251149 /src/include/access/gin.h | |
parent | 1978d7f13fc2c46c74bf60ee84a5a8557391e53b (diff) | |
download | postgresql-356eea24ce6f5e0875b85e938230cfd01ed75ae3.tar.gz postgresql-356eea24ce6f5e0875b85e938230cfd01ed75ae3.zip |
Fix a serious bug introduced into GIN in 8.4: now that MergeItemPointers()
is supposed to remove duplicate heap TIDs, we have to be sure to reduce the
tuple size and posting-item count accordingly in addItemPointersToTuple().
Failing to do so resulted in the effective injection of garbage TIDs into the
index contents, ie, whatever happened to be in the memory palloc'd for the
new tuple. I'm not sure that this fully explains the index corruption
reported by Tatsuo Ishii, but the test case I'm using no longer fails.
Diffstat (limited to 'src/include/access/gin.h')
-rw-r--r-- | src/include/access/gin.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/include/access/gin.h b/src/include/access/gin.h index 49a14b62906..366fc370b0a 100644 --- a/src/include/access/gin.h +++ b/src/include/access/gin.h @@ -4,7 +4,7 @@ * * Copyright (c) 2006-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/access/gin.h,v 1.32 2009/06/05 18:50:47 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/gin.h,v 1.33 2009/06/06 02:39:40 tgl Exp $ *-------------------------------------------------------------------------- */ #ifndef GIN_H @@ -435,6 +435,7 @@ extern void findParents(GinBtree btree, GinBtreeStack *stack, BlockNumber rootBl /* ginentrypage.c */ extern IndexTuple GinFormTuple(GinState *ginstate, OffsetNumber attnum, Datum key, ItemPointerData *ipd, uint32 nipd); +extern void GinShortenTuple(IndexTuple itup, uint32 nipd); extern void prepareEntryScan(GinBtree btree, Relation index, OffsetNumber attnum, Datum value, GinState *ginstate); extern void entryFillRoot(GinBtree btree, Buffer root, Buffer lbuf, Buffer rbuf); @@ -442,7 +443,7 @@ extern IndexTuple ginPageGetLinkItup(Buffer buf); /* gindatapage.c */ extern int compareItemPointers(ItemPointer a, ItemPointer b); -extern void MergeItemPointers(ItemPointerData *dst, +extern uint32 MergeItemPointers(ItemPointerData *dst, ItemPointerData *a, uint32 na, ItemPointerData *b, uint32 nb); |