Re: pre-commit triggers - Mailing list pgsql-hackers

From Andres Freund
Subject Re: pre-commit triggers
Date
Msg-id 20131119164235.GE19293@alap2.anarazel.de
Whole thread Raw
In response to pre-commit triggers  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Hi,

On 2013-11-15 13:01:48 -0500, Andrew Dunstan wrote:
> Attached is a patch to provide a new event trigger that will fire on
> transaction commit. I have tried to make certain that it fires at a
> sufficiently early stage in the commit process that some of the evils
> mentioned in previous discussions on this topic aren't relevant.
> 
> The triggers don't fire if there is no real XID, so only actual data changes
> should cause the trigger to fire. They also don't fire in single user mode,
> so that if you do something stupid like create a trigger that
> unconditionally raises an error you have a way to recover.
> 
> This is intended to be somewhat similar to the same feature in the Firebird
> database, and the initial demand came from a client migrating from that
> system to Postgres.

Could you explain a bit what the use case of this is and why it's not
sufficient to allow constraint triggers to work on a statement level?
"Just" that there would be multiple ones fired?

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Logging WAL when updating hintbit
Next
From: Robert Haas
Date:
Subject: Re: pre-commit triggers