Re: how to get id of currently executed query?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: how to get id of currently executed query?
Дата
Msg-id 4114.1187277630@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: how to get id of currently executed query?  (hubert depesz lubaczewski <depesz@depesz.com>)
Ответы Re: how to get id of currently executed query?
Список pgsql-general
hubert depesz lubaczewski <depesz@depesz.com> writes:
> so - as you can see in one query, the value changes in plpgsql. and i need some
> id that will be unchanged within one end-user-supplied query.

AFAIR, the only state that's guaranteed to work like that is
statement_timestamp.  Of course you have to worry whether your machine
is fast enough to do more than one client interaction within whatever
the clock resolution is.

I think the real question here is why you want this behavior at all;
to me it smells of not having thought the problem through correctly.
As an example of why this bothers me: what if the user's query is
rewritten into several queries by a RULE?  Should you consider each
of those to be a separate user-issued SQL command?  Does your answer
change if you know that the user himself prepared the RULE?  (Do you
think users will be happy if statement X followed by statement Y
acts differently in a rule than elsewhere?)

            regards, tom lane

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

Предыдущее
От: Rainer Bauer
Дата:
Сообщение: Re: Yet Another COUNT(*)...WHERE...question
Следующее
От: "madhtr"
Дата:
Сообщение: Re: pqlib in c++: PQconnectStart PQconnectPoll