X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5845F3A4B41 for ; Fri, 26 Nov 2004 21:34:57 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46481-10 for ; Fri, 26 Nov 2004 21:34:53 +0000 (GMT) Received: from smtp100.rog.mail.re2.yahoo.com (smtp100.rog.mail.re2.yahoo.com [206.190.36.78]) by svr1.postgresql.org (Postfix) with SMTP id E3D2E3A4B1A for ; Fri, 26 Nov 2004 21:34:50 +0000 (GMT) Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@65.49.125.184 with login) by smtp100.rog.mail.re2.yahoo.com with SMTP; 26 Nov 2004 21:34:49 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 2EF07412E; Fri, 26 Nov 2004 16:34:48 -0500 (EST) Date: Fri, 26 Nov 2004 16:34:48 -0500 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: Way to stop recursion? Message-ID: <20041126213448.GB2312@phlogiston.dyndns.org> Mail-Followup-To: pgsql-sql@postgresql.org References: <41A79A2A.6070606@delegated.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41A79A2A.6070606@delegated.net> User-Agent: Mutt/1.5.6+20040722i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/269 X-Sequence-Number: 19587 On Fri, Nov 26, 2004 at 01:03:38PM -0800, Jonathan Knopp wrote: > UPDATE rules work perfectly for what I need to do except I need them to > only run once, not try and recurse (which of course isn't allowedby > postgresql anyway). Triggers seem a less efficient way to do the same > thing, though I understand they would run recursively too. Here's the > table structure in question: You have to do this with a trigger. The problem is that the rule is expanded inline like a macro, so you can't prevent the behaviour you're seeing. A -- Andrew Sullivan | ajs@crankycanuck.ca The fact that technology doesn't work is no bar to success in the marketplace. --Philip Greenspun