Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6593c5b

Browse files
committed
Fix bug in freespace calculation in heap_multi_insert().
If the amount of freespace on page was less than the amount reserved by fillfactor, the calculation would underflow. This fixes bug #6643 reported by Tomonari Katsumata.
1 parent 00b0c73 commit 6593c5b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/access/heap/heapam.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2159,7 +2159,7 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
21592159
{
21602160
HeapTuple heaptup = heaptuples[ndone + nthispage];
21612161

2162-
if (PageGetHeapFreeSpace(page) - saveFreeSpace < MAXALIGN(heaptup->t_len))
2162+
if (PageGetHeapFreeSpace(page) < MAXALIGN(heaptup->t_len) + saveFreeSpace)
21632163
break;
21642164

21652165
RelationPutHeapTuple(relation, buffer, heaptup);

0 commit comments

Comments
 (0)