| От | Peter Eisentraut |
|---|---|
| Тема | alternative to PG_CATCH |
| Дата | |
| Msg-id | c170919d-c78b-3dac-5ff6-9bd12f7a38bc@2ndquadrant.com обсуждение исходный текст |
| Ответы |
Re: alternative to PG_CATCH
Re: alternative to PG_CATCH |
| Список | pgsql-hackers |
This is a common pattern:
PG_TRY();
{
... code that might throw ereport(ERROR) ...
}
PG_CATCH();
{
cleanup();
PG_RE_THROW();
}
PG_END_TRY();
cleanup(); /* the same as above */
I've played with a way to express this more compactly:
PG_TRY();
{
... code that might throw ereport(ERROR) ...
}
PG_FINALLY({
cleanup();
});
See attached patch for how this works out in practice.
Thoughts? Other ideas?
One problem is that this currently makes pgindent crash. That's
probably worth fixing anyway. Or perhaps find a way to write this
differently.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера