Triggers on transaction? - Mailing list pgsql-hackers

From Jordan Gigov
Subject Triggers on transaction?
Date
Msg-id CA+nBocCxTd64U8pteO172VfEZfSavu31oqZK2GzwGf05k7G_6A@mail.gmail.com
Whole thread Raw
Responses Re: Triggers on transaction?
List pgsql-hackers
I found myself in need of triggers that are run only once per transaction, rather than per row or statement within the transaction. Meaning it will always be deferred and never called twice for the same transaction.

Perhaps in 9.6 this part of syntax for trigger creation can be changed from:
[ FOR [ EACH ] { ROW | STATEMENT } ]
to:
[ FOR [ EACH ] { ROW | STATEMENT | TRANSACTION } ]
I looked though the code get an idea of how difficult it would be to implement and I think I might be able to do it, at least for functions without parameters. My idea for functions with parameters is to have them constrained to each one only accepting arrays of the type of element that is passed. Meaning if the column type is integer[], the function must take integer[][] in that parameter. From then on it's a matter of choice whether they'll be passed at original order or reverse and whether the trigger execution will be moved back or not.

Should I bother trying or will such a feature not be accepted into a final release, even if it's working?

pgsql-hackers by date:

Previous
From: Guillaume Lelarge
Date:
Subject: Re: about lob(idea)
Next
From: Marko Tiikkaja
Date:
Subject: Re: Triggers on transaction?