简体   繁体   中英

PostgreSQL - Trigger Each Statement - How to get Query statement

I'm doing a trigger Each Statement and I would like to access the Query Statement that triggered the trigger. Is this possible?

Something like this:

update table_1 where id> 300;

This query triggers an update event in table table_1 and this event triggers a function associated with the update trigger. This trigger is configured as Each Statement and inside the trigger I would like to do something like this:

raise info 'Query Statement that fired this trigger:%', last_query();

Would this be possible?

Thank you!

Julio

Call the function current_query() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM