Re: Is it possible to get username information whilewritingtrigger?

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: Is it possible to get username information whilewritingtrigger?
Дата
Msg-id 1525683560.2414.8.camel@cybertec.at
обсуждение исходный текст
Ответ на Re: Is it possible to get username information while writingtrigger?  ("a" <372660931@qq.com>)
Список pgsql-general
a wrote:
> Please allow me to ask few more questions:
> 
> 1, Since I'm writing a C trigger function, is there any method for me to get some of the
>    basic information like the follow:
> 
>      (1) Total number of rows;
>      (2) Rows' names;
>      (3) Value of OLD and NEW;
> 
> 2, Is there any possibility of passing the SQL statement it self into the trigger?
> 
> 3, Is it possible for me to exam before statement trigger so that I would be able to loop it
>    once and copying the update information to the rest of rows.

I don't know if there is a reliable way to get the SQL statement from
a C trigger.

For the other things, perhaps a statement level trigger with transition
relations can help.

You can then access the transition relations from your C code with
the tg_oldtable and tg_newtable tuplestores.
(https://www.postgresql.org/docs/current/static/trigger-interface.html)

Yours,
Laurenz Albe
-- 
+43-670-6056265
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26, A-2700 Wiener Neustadt
Web: https://www.cybertec-postgresql.com


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

Предыдущее
От: "a"
Дата:
Сообщение: Re: Is it possible to get username information while writingtrigger?
Следующее
От: Markus
Дата:
Сообщение: Re: Query planner riddle (array-related?)