On Sat, Jan 13, 2001 at 01:23:27PM -0800,
Matt Doucleff <matt@digitalfountain.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.