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

From Andrew Dunstan
Subject Re: pre-commit triggers
Date
Msg-id 5294DC56.1070908@dunslane.net
Whole thread Raw
In response to Re: pre-commit triggers  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: pre-commit triggers
List pgsql-hackers
On 11/24/2013 09:42 AM, Simon Riggs wrote:

> It looks to me that this idea is horribly physical and seems likely to
> be badly misused.
>
> I don't see any way to use these that won't be quite ugly. There is no
> trigger descriptor, so no way of writing a constraint sensibly, since
> you'll need to make a constraint check for every commit by every user,
> not just ones that touch the data you care about. And security goes
> straight out the window, so these can't be used in normal application
> development.
>
> Plus we can already do this with RegisterXactCallback() as Alvaro
> points out - so if its a hack we're after, then we already have it, no
> patch required.

"Write a hack" is not normally advice I like to give or receive.

We're after a feature that at least one other RDBMS that we know of suports.

But leaving that aside, what are the restrictions, if any, in what can 
be done in such a callback? Are we allowed to alter the database? If so, 
what happens to FK constraints? Can we raise an ERROR exception?

cheers

andrew



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Logging WAL when updating hintbit
Next
From: Tom Lane
Date:
Subject: Re: Cleaner build output when not much has changed