]> granicus.if.org Git - postgresql/commitdiff
In rewriteheap.c (used by VACUUM FULL and CLUSTER), calculate the tuple
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 9 Nov 2010 15:40:09 +0000 (17:40 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 9 Nov 2010 15:48:14 +0000 (17:48 +0200)
length stored in the line pointer the same way it's calculated in the normal
heap_insert() codepath. As noted by Jeff Davis, the length stored by
raw_heap_insert() included padding but the one stored by the normal codepath
did not. While the mismatch seems to be harmless, inconsistency isn't good,
and the normal codepath has received a lot more testing over the years.

Backpatch to 8.3 where the heap rewrite code was introduced.

src/backend/access/heap/rewriteheap.c

index 0bd1865068255b6d78bc684f0a925fed7fae4858..19ca302ebb9456c1ce9d767dd0659ac11f6b1678 100644 (file)
@@ -641,7 +641,7 @@ raw_heap_insert(RewriteState state, HeapTuple tup)
        }
 
        /* And now we can insert the tuple into the page */
-       newoff = PageAddItem(page, (Item) heaptup->t_data, len,
+       newoff = PageAddItem(page, (Item) heaptup->t_data, heaptup->t_len,
                                                 InvalidOffsetNumber, false, true);
        if (newoff == InvalidOffsetNumber)
                elog(ERROR, "failed to add tuple");