Thread: Trigger on transaction?

Trigger on transaction?

From
sixtus@gmail.com
Date:
Hello all,


I've been enjoying programming postgres for a while, but I am stuck
with a problem neither the excellent documentation nor the search on
this mailing list provides with a solution.

It's been asked before, I too would like to have a trigger on transaction!

Use cases:

- I want to version a table which sees multiple updates during one
transaction, but I only need transaction resolution. My solution would
be a trigger on insert/update to copy into a temporary table (where
multiple updates overwrite the old value) and on commit copy into the
version table.

- I would like to have transient data within a persistent table. While
I am in the transaction, the transient information is available, on
commit it is deleted. The only other solution I can think of is a
temporary table inheriting my persistent table. Is that doable? How do
I move a row from parent to child table, will that value drop when the
transaction ends?


Any help greatly appreciated!

Regards,

Hagen