Vitaly Burovoy <vitaly.buro...@gmail.com> writes: > On 1/30/16, Pavel Stehule <pavel.steh...@gmail.com> wrote: >> I though about it, but it is not possible. Every PG_TRY/CATCH must be >> finished by RETHROW.
> No, src/include/utils/elog.h tells different (emphasizes are mine): > "The error recovery code can _optionally_ do PG_RE_THROW() to > propagate the _same_ error outwards." > So you can use it without rethrowing. You can use it without re-throwing, but ONLY if you use the full subtransaction mechanism to clean up. Assuming that the only possible errors are ones that don't need cleanup will get your patch rejected. IME, in practically all cases in simple C functions, it's better to find a way that doesn't require using TRY/CATCH to catch an expected error. regards, tom lane -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers