Re: PL/PgSQL: EXIT USING ROLLBACK

Поиск
Список
Период
Сортировка
От Joel Jacobson
Тема Re: PL/PgSQL: EXIT USING ROLLBACK
Дата
Msg-id CAASwCXd+4vfoF-c5bxPizTfKfA5ZeVBN-ZcVrH8W2MhbYmf3cw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PL/PgSQL: EXIT USING ROLLBACK  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: PL/PgSQL: EXIT USING ROLLBACK  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Sat, Jul 26, 2014 at 8:39 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Basically my point is that this just seems like inventing another way to
> do what one can already do with RAISE, and it doesn't have much redeeming
> social value to justify the cognitive load of inventing another construct.

The main difference is with RAISE EXCEPTION 'OK'; you cannot know if
it was *your* line of code which throw the 'OK'-exception or if it
came from some other function which was called in the block of code.

This means with the current way you have to inspect all lines of code
in all functions in the entire call graph for the block of code for
which you want to capture the 'OK'-exception (or whatever name one
wishes to use),
alternatively to use a name which is guaranteed to be unique, such as
a UUID or something which no other line of code could possibly emmit
as an exception.

Both approaches are ugly and hackish. I think the language should
provide a documented and safe way of exiting from a begin block
without having to worry about other code raising exceptions of the
same name.



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

Предыдущее
От: Joel Jacobson
Дата:
Сообщение: PL/pgSQL 2
Следующее
От: Andres Freund
Дата:
Сообщение: Re: PL/pgSQL 2