Re: pre-commit triggers

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pre-commit triggers
Date: 2013-11-26 17:37:26
Message-ID: 5294DC56.1070908@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-11-26 17:37:48 Re: Cleaner build output when not much has changed
Previous Message Tom Lane 2013-11-26 17:28:01 Re: Logging WAL when updating hintbit