Re: custom function for converting human readable sizes to bytes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: custom function for converting human readable sizes to bytes
Дата
Msg-id 67556.1454227637@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: custom function for converting human readable sizes to bytes  (Vitaly Burovoy <vitaly.burovoy@gmail.com>)
Список pgsql-hackers
Vitaly Burovoy <vitaly.burovoy@gmail.com> writes:
> On 1/30/16, Pavel Stehule <pavel.stehule@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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: WIP: Covering + unique indexes.
Следующее
От: Masahiko Sawada
Дата:
Сообщение: Re: Support for N synchronous standby servers - take 2