Re: Trigger

From: Peter Childs <blue(dot)dragon(at)blueyonder(dot)co(dot)uk>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Peter Childs <blue(dot)dragon(at)blueyonder(dot)co(dot)uk>, "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Trigger
Date: 2003-10-23 12:06:46
Message-ID: Pine.LNX.4.58.0310231301260.15015@bluedragon.homelinux.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 23 Oct 2003, Alvaro Herrera wrote:

> On Thu, Oct 23, 2003 at 08:16:27AM +0100, Peter Childs wrote:
> >
> >
> > On Wed, 22 Oct 2003, scott.marlowe wrote:
> >
> > > On Wed, 22 Oct 2003, Peter Childs wrote:
> > >
> > > > Is it possible to deferr a trigger until commit, Or to have the
> > > > trigger not occur if the transaction is rolled back? Like transaction.
> >
> > Background, we are trying to get the database to tell clients when
> > records get updated, deleted or inserted so that they can update there
> > on-screen displays without having to query the database every couple of
> > seconds which would put an unnessary strain on the database. Hence
> > producing quicker respose times.
>
> You should probably be using an AFTER trigger ... when those get
> executed, the transaction is ready to commit and will not abort (barring
> any major problems, like your server go nuts or something).

Using an After trigger but the transactions may still rollback. a
subsquent query may fail before commit or a constraint may fail.

>
> But why don't you use some notifications and set up appropiate listeners
> on the OSDs? See the NOTIFY/LISTEN reference pages ... these also get
> delivered during transaction commit.

Great idea shame drivers to get at these are rare. Anyway you
still need a trigger to fire the notify and these get sent when the query
is done not when its commented. hmmm

Peter Childs

>
> --
> Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
> "In fact, the basic problem with Perl 5's subroutines is that they're not
> crufty enough, so the cruft leaks out into user-defined code instead, by
> the Conservation of Cruft Principle." (Larry Wall, Apocalypse 6)
>

In response to

  • Re: Trigger at 2003-10-23 11:47:19 from Alvaro Herrera

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Thomas 2003-10-23 12:16:16 Re: database files
Previous Message Alvaro Herrera 2003-10-23 11:47:19 Re: Trigger