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 3A77C9DC812 for ; Thu, 2 Mar 2006 08:19:43 -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 57868-09 for ; Thu, 2 Mar 2006 08:19:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from r1.mycybernet.net (r1.mycybernet.net [209.5.206.8]) by postgresql.org (Postfix) with ESMTP id 17ECE9DC840 for ; Thu, 2 Mar 2006 08:19:40 -0400 (AST) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227]:40294 helo=phlogiston.dydns.org) by r1.mycybernet.net with esmtp (Exim 4.50 (FreeBSD)) id 1FEmmW-000FbP-1b for pgsql-sql@postgresql.org; Thu, 02 Mar 2006 07:19:44 -0500 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 617B64040; Thu, 2 Mar 2006 07:19:43 -0500 (EST) Date: Thu, 2 Mar 2006 07:19:43 -0500 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: Help with trigger that updates a row prior to a potentially aborted deletion? Message-ID: <20060302121943.GA7057@phlogiston.dyndns.org> References: <20060301182345.GJ17356@phlogiston.dyndns.org> <20060301204125.3A4B2199B1C@smtp04l.fasthosts.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060301204125.3A4B2199B1C@smtp04l.fasthosts.co.uk> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.081 required=5 tests=[AWL=0.081] X-Spam-Score: 0.081 X-Spam-Level: X-Archive-Number: 200603/43 X-Sequence-Number: 24389 On Wed, Mar 01, 2006 at 08:41:20PM -0000, Simon Kinsella wrote: > Ok thanks, will check this out. Is that the same as savepoints, or something > different? (am using 8.1.2) Yes, same thing. > At the moment I'm investigating using a rule (rewrite the DELETE as an > UPDATE to set the flag, then use an AFTER UPDATE trigger to attempt to > delete the row if the flag was set). Not sure if it's going to work but if > so I'll post back. In a message you sent that I read after I sent mine, you also said you had to be able to handle deletes from the table with CASCADE. My suggestion won't work for that, I don't think (but it might be worth a try). The only other thing I can think of is just flag everything, and use a daemon to go around and perform the actual deletes for you. A -- Andrew Sullivan | ajs@crankycanuck.ca The plural of anecdote is not data. --Roger Brinner