Use repalloc_huge() to enlarge a SPITupleTable's tuple pointer array.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 14 Mar 2016 18:22:16 +0000 (14:22 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 14 Mar 2016 18:22:34 +0000 (14:22 -0400)
Commit 23a27b039d94ba35 widened the rows-stored counters to uint64, but
that's academic unless we allow the tuple pointer array to exceed 1GB.

(It might be a good idea to provide some other limit on how much storage
a SPITupleTable can eat.  On the other hand, there are plenty of other
ways to drive a backend into swap hell.)

Dagfinn Ilmari MannsÃ¥ker

src/backend/executor/spi.c

index 3d04c23b4e0cc9ab8e01d433a4936da7fd230291..fd9417904fd23a9bcebf229a549e86ae580d839d 100644 (file)
@@ -1800,7 +1800,7 @@ spi_printtup(TupleTableSlot *slot, DestReceiver *self)
        /* Double the size of the pointer array */
        tuptable->free = tuptable->alloced;
        tuptable->alloced += tuptable->free;
-       tuptable->vals = (HeapTuple *) repalloc(tuptable->vals,
+       tuptable->vals = (HeapTuple *) repalloc_huge(tuptable->vals,
                                      tuptable->alloced * sizeof(HeapTuple));
    }