Re: transction_timestamp() inside of procedures

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: transction_timestamp() inside of procedures
Дата
Msg-id 32763.1539028428@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: transction_timestamp() inside of procedures  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On October 8, 2018 10:14:34 AM PDT, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Surely there is some way that we can directly test whether we're inside
>> a procedure or not?  I think the logic should be basically
>> ...

> Seems more reasonable from here.

We are rapidly running out of time to get this fixed before RC1.
In the interests of getting across the finish line, I took a look
around, and found that indeed there does not seem to be any exported
way to detect whether we're inside a procedure or not.  Which seems
pretty darn dumb from here.

The best way to determine that seems to be to check that that the SPI
stack is (a) nonempty and (b) has a "nonatomic" topmost entry.

Barring objections, I'm going to make a quick hack that adds a SPI
entry point along the lines of "bool SPI_inside_nonatomic_context(void)"
to do that test, adapt the xact.c code as I said upthread, and commit
with Peter's regression test case.

            regards, tom lane



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

Предыдущее
От: Jennifer Miller
Дата:
Сообщение: Percona is Seeking a PostgreSQL Consultant [North AMER based]
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: [HACKERS] [WIP] Zipfian distribution in pgbench