From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | a <372660931(at)qq(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Is it possible to get username information while writingtrigger? |
Date: | 2018-05-07 08:59:20 |
Message-ID: | 1525683560.2414.8.camel@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Markus | 2018-05-07 09:12:23 | Re: Query planner riddle (array-related?) |
Previous Message | a | 2018-05-07 08:39:41 | Re: Is it possible to get username information while writingtrigger? |