aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2012-05-16 14:10:29 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2012-05-16 14:13:06 +0300
commit6593c5b5dc39b179b1b7a3c947df2596af3e70c9 (patch)
tree8c8d39c32282d057dacfd6a904d4358db9409c63 /src
parent00b0c73f1f2b98a7d09de63aaa14d6498ac521ae (diff)
downloadpostgresql-6593c5b5dc39b179b1b7a3c947df2596af3e70c9.tar.gz
postgresql-6593c5b5dc39b179b1b7a3c947df2596af3e70c9.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/heap/heapam.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 7e4c8f52ab2..0d6fe3f0acd 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -2159,7 +2159,7 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
{
HeapTuple heaptup = heaptuples[ndone + nthispage];
- if (PageGetHeapFreeSpace(page) - saveFreeSpace < MAXALIGN(heaptup->t_len))
+ if (PageGetHeapFreeSpace(page) < MAXALIGN(heaptup->t_len) + saveFreeSpace)
break;
RelationPutHeapTuple(relation, buffer, heaptup);