"Asif Ali" <asifalirehman(at)gmail(dot)com> writes:
> I have compiled postgres 8.2.1 with gcc 4.1. and when executed this function
> it crashes the server.
The attached patch (against HEAD) fixes your test case, but please see
whether it fixes your original problem; I'm not 100% confident in it
yet. There seem to be two different bugs here...
regards, tom lane