From: Alvaro Herrera <alvherre@dcc.uchile.cl>
To: Peter Childs <blue.dragon@blueyonder.co.uk>
Cc: scott.marlowe <scott.marlowe@ihs.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Trigger
Date: Thu, 23 Oct 2003 08:47:19 -0300
Message-ID: <20031023114719.GA23703@dcc.uchile.cl> (raw)
In-Reply-To: <Pine.LNX.4.58.0310230811060.11940@bluedragon.homelinux.net>
References: <Pine.LNX.4.33.0310221306330.12830-100000@css120.ihs.com>
<Pine.LNX.4.58.0310230811060.11940@bluedragon.homelinux.net>
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).
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.
--
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)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: alvherre@dcc.uchile.cl, blue.dragon@blueyonder.co.uk, scott.marlowe@ihs.com
Subject: Re: Trigger
In-Reply-To: <20031023114719.GA23703@dcc.uchile.cl>
References: <Pine.LNX.4.33.0310221306330.12830-100000@css120.ihs.com> <Pine.LNX.4.58.0310230811060.11940@bluedragon.homelinux.net> <20031023114719.GA23703@dcc.uchile.cl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox