Harry Broomhall <harry.broomhall@uk.easynet.net> writes:
> The reason I say it runs out of memory is the message:
> ERROR: Memory exhausted in AllocSetAlloc(36)
> in the log file, and I am running 'top' and see the process hit 512MB at
> about this point!
Sounds like running out of memory to me too ;-)
We have found (and fixed) various intra-function-call memory leaks in
plpgsql in the past, and I wouldn't be surprised to find more. Which
PG version is this exactly? If it's current, can you supply a complete
test case to cause the problem? I'd be happy to look into it.
regards, tom lane