On Mon, Aug 17, 2015 at 7:56 AM, Tom Lane <[email protected]> wrote:
> Hi Neil! Long time no see.
Likewise :)
>> Attached is a one-liner to double the size of the table when space is
>> exhausted.
>
> I think this could use a comment, but otherwise seems OK.
Attached is a revised patch with a comment.
> Should we back-patch this change? Seems like it's arguably a
> performance bug.
Sounds good to me.
Neil
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index d544ad9..05a2b21 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -1797,7 +1797,8 @@ spi_printtup(TupleTableSlot *slot, DestReceiver *self)
if (tuptable->free == 0)
{
- tuptable->free = 256;
+ /* Double the size of the table */
+ tuptable->free = tuptable->alloced;
tuptable->alloced += tuptable->free;
tuptable->vals = (HeapTuple *) repalloc(tuptable->vals,
tuptable->alloced * sizeof(HeapTuple));
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers