X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0CC459DC9EC for ; Wed, 8 Mar 2006 19:31:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92606-03 for ; Wed, 8 Mar 2006 19:31:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by postgresql.org (Postfix) with ESMTP id 08ED29DC890 for ; Wed, 8 Mar 2006 19:31:02 -0400 (AST) X-EthosMedia-Virus-Scanned: no infections found Received: from [64.81.245.111] (account josh@agliodbs.com HELO [192.168.1.27]) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 9078664; Wed, 08 Mar 2006 15:34:01 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: chester c young Subject: Re: Is there any way to stop triggers from cycling? Date: Wed, 8 Mar 2006 15:29:09 -0800 User-Agent: KMail/1.8 Cc: pgsql-sql@postgresql.org References: <20060308230419.53923.qmail@web54308.mail.yahoo.com> In-Reply-To: <20060308230419.53923.qmail@web54308.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603081529.09356.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.084 required=5 tests=[AWL=0.084] X-Spam-Score: 0.084 X-Spam-Level: X-Archive-Number: 200603/130 X-Sequence-Number: 24476 Chester, > take advantage of "instead of" or "do also" rules to create a compound > statement before your triggers do their work. (in terms of maintenance > and sanity, it's best if a trigger touches only its own record.) Ah, I see ... so: 1) create a view on the table 2) put a rule on the view to re-order, which re-orders the *table* so there's no cascade 3) use the triggers to do the other tree-maintenance stuff, only for their own rows/children (cascading triggers work *very* well for tree maintenance). -- --Josh Josh Berkus Aglio Database Solutions San Francisco