Re: Document that PG_TRY block cannot have a return statement

Поиск
Список
Период
Сортировка
От Serpent
Тема Re: Document that PG_TRY block cannot have a return statement
Дата
Msg-id CANncwrK20zn7OiwwUtEmXLcsGyU0QF_NceaPtPBtooSEKcvmQg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Document that PG_TRY block cannot have a return statement  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

What about this wording:

The code that might throw ereport(ERROR) cannot contain any non local control flow other than ereport(ERROR) e.g.: return, goto, break, continue.
In other words once PG_TRY() is executed, either PG_CATCH() or PG_FINALLY() must be executed as well.

I used 'code that might throw ereport(ERROR)' for XXX since this is what's used earlier in the comment.

On Tue, 12 Sept 2023 at 17:22, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Serpent <serpent7776@gmail.com> writes:
> I'm talking about this part:

> PG_TRY();
> {
>   ... code that might throw ereport(ERROR) ...
> }

Ah.  Your phrasing needs work for clarity then.  Also, "return"
is hardly the only way to break it; break, continue, or goto
leading out of the PG_TRY are other possibilities.  Maybe more
like "The XXX code must exit normally (by control reaching
the end) if it does not throw ereport(ERROR)."  Not quite sure
what to use for XXX.

                        regards, tom lane
Вложения

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

Предыдущее
От: torikoshia
Дата:
Сообщение: Re: Make --help output fit within 80 columns per line
Следующее
От: Nazir Bilal Yavuz
Дата:
Сообщение: Re: BufferUsage counters' values have changed