Fix a serious bug introduced into GIN in 8.4: now that MergeItemPointers()
commit32779d396884cba6bb1c68a14db14e34f7280612
authortgl <tgl>
Sat, 6 Jun 2009 02:39:40 +0000 (6 02:39 +0000)
committertgl <tgl>
Sat, 6 Jun 2009 02:39:40 +0000 (6 02:39 +0000)
tree2bbfe09549d55dd2a0d02e4029045b12d59364d3
parent55fb3490465f8dc4fb6664ed0ae11abdfcbb7e77
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.
src/backend/access/gin/gindatapage.c
src/backend/access/gin/ginentrypage.c
src/backend/access/gin/gininsert.c
src/include/access/gin.h