简体   繁体   中英

Retrieve updated rows in AFTER UPDATE trigger Postgresql

I'm writing a AFTER UPDATE trigger in postgresql.

Actualy I need to get at least one row after update in STATEMENT LEVEL trigger, but there is no OLD or NEW variable there.

In FOR EACH ROW trigger I didn't manage to find a sort of batch_last param. But to do my procedure FOR EACH ROW is expensive.

How can I do this?

You can create a temporary table (so that it will visible only in the session). In the row level trigger you insert the rows into the temporary table, in the statement level trigger you select (and delete) from the temporary table.

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