Re: PL/Python: Fix return in the middle of PG_TRY() block.

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: PL/Python: Fix return in the middle of PG_TRY() block.
Дата
Msg-id Y8C3137zhciaQoRz@paquier.xyz
обсуждение исходный текст
Ответ на Re: PL/Python: Fix return in the middle of PG_TRY() block.  (Nathan Bossart <nathandbossart@gmail.com>)
Список pgsql-hackers
On Thu, Jan 12, 2023 at 10:44:33AM -0800, Nathan Bossart wrote:
> There's another "return" later on in this PG_TRY block.  I wonder if it's
> possible to detect this sort of thing at compile time.

Note also:
src/pl/tcl/pltcl.c- *   PG_CATCH();
src/pl/tcl/pltcl.c- *   {
src/pl/tcl/pltcl.c- *       pltcl_subtrans_abort(interp, oldcontext, oldowner);
src/pl/tcl/pltcl.c- *       return TCL_ERROR;
src/pl/tcl/pltcl.c- *   }

This is documented once, repeated twice:
src/pl/plpython/plpy_spi.c- *   PG_CATCH();
src/pl/plpython/plpy_spi.c- *   {
src/pl/plpython/plpy_spi.c- *       <do cleanup>
src/pl/plpython/plpy_spi.c- *       PLy_spi_subtransaction_abort(oldcontext, oldowner);
src/pl/plpython/plpy_spi.c- *       return NULL;
src/pl/plpython/plpy_spi.c- *   }

I don't quite get why this would be a sane thing to do here when
aborting a subtransaction in pl/python, but my experience with this
code is limited.
--
Michael

Вложения

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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: pgsql: Add new GUC createrole_self_grant.
Следующее
От: Amin
Дата:
Сообщение: Get relid for a relation