X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5E212D1EC43 for ; Tue, 23 Mar 2004 17:22:34 +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 79732-10 for ; Tue, 23 Mar 2004 13:22:30 -0400 (AST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 24C30D1EC3F for ; Tue, 23 Mar 2004 13:22:30 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 5B3B33532E; Tue, 23 Mar 2004 09:22:29 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 59A7D3524B; Tue, 23 Mar 2004 09:22:29 -0800 (PST) Date: Tue, 23 Mar 2004 09:22:29 -0800 (PST) From: Stephan Szabo To: Erik Thiele Cc: Bruno Wolff III , pgsql-sql@postgresql.org Subject: Re: fine grained trigger time specification... In-Reply-To: <20040323175625.4610b511.erik@thiele-hydraulik.de> Message-ID: <20040323092023.V89245@megazone.bigpanda.com> References: <20040323151913.13de3fa7.erik@thiele-hydraulik.de> <20040323161731.GC22109@wolff.to> <20040323175625.4610b511.erik@thiele-hydraulik.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/237 X-Sequence-Number: 17336 On Tue, 23 Mar 2004, Erik Thiele wrote: > On Tue, 23 Mar 2004 10:17:31 -0600 > Bruno Wolff III wrote: > > > On Tue, Mar 23, 2004 at 15:19:13 +0100, > > Erik Thiele wrote: > > > now sadly i am getting this kind of problem: > > > > > > > > > zeit=> insert into a select > > > nextval('delmeseq'),personalnumber,datum,datum from calendar where > > > type=10409; > > > INSERT 0 581 <-- see, 581 inserts which is pretty much :) > > > zeit=> commit; <-- now i have to wait for 581 calls of alwayscheck > > > > > > > > > since alwayscheck is not the fastest function on earth, i'd like to have > > > it called on commit time if at least one of table a or b was modified, > > > but always only once per commit. is there a way to formulate this: > > > > > > ARRANGE FOR CALL OF FUNCTION alwayscheck() ON COMMIT WHEN AT LEAST ONE > > > OF TABLE a OR TABLE b WAS MODIFIED BUT CALL THE FUNCTION AT MOST ONE > > > TIME; I didn't see the original, but... One way to do hack this up is triggers which insert a row into another holding table if and only if it hasn't already (something like transaction id or some such - something you don't need to worry about concurrency with) which itself has a deferred trigger on insert (which should probably remove the row as part of its behavior).