Stefan Kaltenbrunner <ste...@kaltenbrunner.cc> writes:
> However the error seems to go away after an ANALYZE... so I wonder if 
> this is just another case of "if we missestimated the size of the 
> hashtable we are doomed"

Actually, what seems to be happening on a 32-bit machine is that
ExecChooseHashTableSize sets nbatch = INT_MAX/2, and then when we
try to do

                hashtable->outerBatchFile = (BufFile **)
                        palloc0(nbatch * sizeof(BufFile *));

the memory size calculation overflows to zero, so we get an empty
outerBatchFile array.  So the fix is to make sure we limit the
number of batches to something sane, perhaps work_mem / sizeof(pointer).

                        regards, tom lane

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to