Carl Sopchak <carl(dot)sopchak(at)cegis123(dot)com> writes:
> Here's what's around the error message in the log:
> SPI Proc: 3154128080 total in 398 blocks; 13664 free (178 chunks);
> 3154114416 used
Hmm, so apparently some internal leak within the plpgsql engine. I'd be
willing to look into this if you can provide a self-contained test case.
(I don't wish to spend time trying to reverse engineer suitable tables
and data from the fragmentary function you posted, even assuming that it
would show the leak ...)
regards, tom lane