seemingly reasonable queries (like ones involving "distinct") fail from within monitor and psql with warnings like WARN:May 5 07:19:39:cannot open temp_81376 and FATAL: no response from backend: detected in dump_data The WARN errors come almost immediately, and the FATAL errors come after the query has been running for a couple of seconds.
Apply this patch:
diff -c src/backend/utils/sort/psort.c:1.4 src/backend/utils/sort/psort.c:1.5
*** src/backend/utils/sort/psort.c:1.4 1995/03/10 19:56:42
--- src/backend/utils/sort/psort.c 1995/05/13 00:19:18
***************
*** 315,320 ****
--- 315,321 ----
puttuple(&nextrun, tup, 0);
else
puttuple(&Tuples, tup, 0);
+ ReleaseBuffer(b);
}
if (lasttuple != NULL) {
FREEMEM(lasttuple->t_len);
diff -c src/backend/storage/buffer/localbuf.c:1.3 src/backend/storage/buffer/localbuf.c:1.4
*** src/backend/storage/buffer/localbuf.c:1.3 1995/04/15 00:28:06
--- src/backend/storage/buffer/localbuf.c 1995/05/13 00:19:53
***************
*** 59,65 ****
LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr)
{
int i;
! BufferDesc *bufHdr;
if (blockNum == NEW_BLOCK) {
blockNum = reln->rd_nblocks;
--- 59,65 ----
LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr)
{
int i;
! BufferDesc *bufHdr = NULL;
if (blockNum == NEW_BLOCK) {
blockNum = reln->rd_nblocks;