postgresql/src/backend/utils/sort
Tom Lane 669ac03af6 Fix failure to account for memory used by tuplestore_putvalues().
This oversight could result in a tuplestore using much more than the
intended amount of memory.  It would only happen in a code path that loaded
a tuplestore via tuplestore_putvalues(), and many of those won't emit huge
amounts of data; but cases such as holdable cursors and plpgsql's RETURN
NEXT command could have the problem.  The fix ensures that the tuplestore
will switch to write-to-disk mode when it overruns work_mem.

The potential overrun was finite, because we would still count the space
used by the tuple pointer array, so the tuplestore code would eventually
flip into write-to-disk mode anyway.  When storing wide tuples we would
go far past the expected work_mem usage before that happened; but this
may account for the lack of prior reports.

Back-patch to 8.4, where tuplestore_putvalues was introduced.

Per bug #6061 from Yann Delorme.
2011-06-15 14:05:49 -04:00
..
logtape.c Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
Makefile Refactor backend makefiles to remove lots of duplicate code 2008-02-19 10:30:09 +00:00
tuplesort.c pgindent run for 9.0 2010-02-26 02:01:40 +00:00
tuplestore.c Fix failure to account for memory used by tuplestore_putvalues(). 2011-06-15 14:05:49 -04:00