pgsql-bugs(at)postgresql(dot)org writes:
> vacuum dies when called from plpgsql after large delete
VACUUM from plpgsql doesn't work period, because of transaction/memory
management issues. I believe we recently accepted a patch to reject
attempts to do it.
regards, tom lane