Re: before/after triggers

From: Richard Huxton <dev(at)archonet(dot)com>
To: gearond(at)cvc(dot)net, pgsql-general(at)postgresql(dot)org
Subject: Re: before/after triggers
Date: 2003-03-27 12:43:35
Message-ID: 200303271243.35959.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday 26 Mar 2003 10:30 pm, Dennis Gearon wrote:
> If I have a before trigger on table 'A' modify table 'B' and an after
> trigger on table 'A' fails for that transaction:

All triggers take place within a single transaction.

> 1/ Is the change to table 'B' visible to anybody except that tranaction at
> any time?

Shouldn't be. It will never be committed.

> 2/ Does the change to table 'B' disappear/never show up when the after
> trigger fails?

Yes.

> 3/ Would all after triggers in that transaction see the change to table 'B'
> before the one particular after trigger fails?

Should do - they're in the same transaction. See chapter 9.2 of the user guide
"Transaction Isolation" for details

> 4/ do all the major DB's have this functionality? I.E.
>
> Oracle
> Sybase
> MSSQL (yuck)
> DB2
> <other examples welcome>

Sorry, can't comment. All should offer similar functionality, but whether the
behaviour is identical I wouldn't want to say without testing.
--
Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2003-03-27 12:45:28 Re: indexes
Previous Message kusum m 2003-03-27 11:09:50 requesting for command details