Re: How do I get the SQL statement in a trigger?

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: How do I get the SQL statement in a trigger?
Дата
Msg-id CAFj8pRDiooLRVsfTe9JOzrCyL4c6D1ad5b=1NAvxLkMDw=93sg@mail.gmail.com
обсуждение исходный текст
Ответ на How do I get the SQL statement in a trigger?  ("a" <372660931@qq.com>)
Ответы Re: How do I get the SQL statement in a trigger?  ("a" <372660931@qq.com>)
Список pgsql-general
Hi

2018-05-10 12:23 GMT+02:00 a <372660931@qq.com>:
Hi I would like to write a trigger that recorded every sql statement under the effected entry. So if it is possible to retrieve the sql statement within a trigger??

You can read a tom command from pg_stat_activity table

 postgres=# select query from pg_stat_activity where pid = pg_backend_pid();
+------------------------------------------------------------------+
|                              query                               |
+------------------------------------------------------------------+
| select query from pg_stat_activity where pid = pg_backend_pid(); |
+------------------------------------------------------------------+
(1 row)


But this information is available only for top level query.

Regards

Pavel

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

Предыдущее
От: Karsten Hilbert
Дата:
Сообщение: Re: Domain based on TIMEZONE WITH TIME ZONE
Следующее
От: "a"
Дата:
Сообщение: Re: How do I get the SQL statement in a trigger?