Re: Is it possible to get username information whilewritingtrigger? - Mailing list pgsql-general

From Laurenz Albe
Subject Re: Is it possible to get username information whilewritingtrigger?
Date
Msg-id 1525683560.2414.8.camel@cybertec.at
Whole thread Raw
In response to Re: Is it possible to get username information while writingtrigger?  ("a" <372660931@qq.com>)
List 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 by date:

Previous
From: "a"
Date:
Subject: Re: Is it possible to get username information while writingtrigger?
Next
From: Markus
Date:
Subject: Re: Query planner riddle (array-related?)