Andres Freund <andres(at)2ndquadrant(dot)com> writes:
>> Absolutely. Probably best to save errno into a local just before the
>> ereport.
> I think just resetting to edata->saved_errno is better and sufficient?
-1 --- that field is nobody's business except elog.c's.
regards, tom lane