Re: Proposed ProcessUtility() API additions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Proposed ProcessUtility() API additions
Дата
Msg-id 3298.1173332942@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Proposed ProcessUtility() API additions  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> "Tom Lane" <tgl@sss.pgh.pa.us> writes:
>> The point of adding is_top_level is to provide a simpler, more reliable
>> means for PreventTransactionChain and related functions to detect
>> whether a function is trying to invoke a non-transaction-block-safe
>> command.

> I'm not exactly following. How does the exec_simple_query or
> exec_execute_message tell you whether you're in a transaction?

Read PreventTransactionChain and friends.  We can tell from state info
provided by xact.c whether we're inside a BEGIN block.  The problem
stems from cases like
SELECT myfunc()

where myfunc() tries to execute one of the verboten commands, via SPI or
some similar mechanism.  If we allowed that, then the function could try
to execute more commands within the same top-level transaction, which is
exactly what we don't want to allow.  If the command is being issued
directly by exec_simple_query or exec_execute_message, and it's not
inside a BEGIN block, then there's no way for an additional command to
be issued before commit.
        regards, tom lane


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

Предыдущее
От: Greg Smith
Дата:
Сообщение: Re: Log levels for checkpoint/bgwriter monitoring
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: Auto creation of Partitions