X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B9E5FD1B4FD for ; Thu, 23 Oct 2003 11:47:54 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 37187-01 for ; Thu, 23 Oct 2003 08:47:26 -0300 (ADT) Received: from cm-lcon2-53-101.cm.vtr.net (CM-lcon2-53-101.cm.vtr.net [200.83.53.101]) by svr1.postgresql.org (Postfix) with ESMTP id CB983D1B510 for ; Thu, 23 Oct 2003 08:47:22 -0300 (ADT) Received: by cm-lcon2-53-101.cm.vtr.net (Postfix, from userid 500) id 926EA8022E; Thu, 23 Oct 2003 08:47:19 -0300 (CLST) Date: Thu, 23 Oct 2003 08:47:19 -0300 From: Alvaro Herrera To: Peter Childs Cc: "scott.marlowe" , pgsql-general@postgresql.org Subject: Re: Trigger Message-ID: <20031023114719.GA23703@dcc.uchile.cl> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/1115 X-Sequence-Number: 51188 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 () "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)