From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Matt Doucleff <matt(at)digitalfountain(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Need "InBetween" (not just Before and After) Trigger |
Date: | 2001-01-13 22:16:47 |
Message-ID: | 20010113161647.B28414@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sat, Jan 13, 2001 at 01:23:27PM -0800,
Matt Doucleff <matt(at)digitalfountain(dot)com> wrote:
>
> If I use a "before" trigger, the constraints are checked after I've already
> performed my action. Thus I have performed my action yet no row is inserted
> (which is inconsistent).
>
> If I use an "after" trigger, the constraints are checked first. If the row is
> inserted, I attempt to perform my action. If my action fails, then I have an
> inserted row but no action, which is also inconsistent.
>
> The only solution I've developed involves a duplicate table and a transaction.
I think what you want to do is defer constraint checking until the end of
a transaction. You can make a constraint deferable and make the default for
it to be checked at the end of a transaction instead of immediately after
a change.
From | Date | Subject | |
---|---|---|---|
Next Message | Uro Gruber | 2001-01-13 23:24:34 | Compare dates. |
Previous Message | Matt Doucleff | 2001-01-13 21:23:27 | Need "InBetween" (not just Before and After) Trigger |