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

From Andres Freund
Subject Re: pre-commit triggers
Date
Msg-id 20131119205428.GB29414@awork2.anarazel.de
Whole thread Raw
In response to Re: pre-commit triggers  (Josh Berkus <josh@agliodbs.com>)
Responses Re: pre-commit triggers  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
On 2013-11-19 12:45:27 -0800, Josh Berkus wrote:
> On 11/19/2013 08:42 AM, Andres Freund wrote:
> > 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?
> 
> The main reason is to enforce arbitrary assertions which need
> enforcement at the end of a transaction and not before.  For example:
> [...]
> You can't enforce this at the statement level because the
> update/insert/deletes can happen in any order on the various tables.

That's why I suggested adding statement level constraint triggers
(should be a farily small patch), which can be deferred till commit. The
problem there is that they can be triggered several times, but that can
relatively easily accounted for in user code.

I can't really say why, but commit time even triggers make me nervous...

Greetings,

Andres Freund

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



pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: pre-commit triggers
Next
From: Robert Haas
Date:
Subject: Re: -d option for pg_isready is broken