Thomas Hallgren <thomas@tada.se> writes:
> As it turns out, I'm not supposed to allocate the returned tuple in the
> caller context.
Where do you get that from? plpgsql and plperl both do it that way AFAICS.
Are you testing in an --enable-cassert build? The memory-clobber
behavior that that turns on is really essential for finding
dangling-pointer problems ...
regards, tom lane