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 F120C5362B for ; Fri, 8 Apr 2005 17:02:38 +0100 (BST) 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 61997-08 for ; Fri, 8 Apr 2005 16:02:34 +0000 (GMT) Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91]) by svr1.postgresql.org (Postfix) with ESMTP id 646685362A for ; Fri, 8 Apr 2005 17:02:33 +0100 (BST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-33.mail.demon.net with esmtp (Exim 4.42) id 1DJvwD-0002hH-Aj; Fri, 08 Apr 2005 16:02:29 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 3B1071646B; Fri, 8 Apr 2005 17:02:25 +0100 (BST) Message-ID: <4256AB11.6070206@archonet.com> Date: Fri, 08 Apr 2005 17:02:25 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Andrew Sullivan , pgsql-sql@postgresql.org Subject: Re: Question on triggers and plpgsql References: <4255AA15.8000508@mochima.com> <14244.1112970986@sss.pgh.pa.us> <20050408145928.GA27718@phlogiston.dyndns.org> <14740.1112974547@sss.pgh.pa.us> In-Reply-To: <14740.1112974547@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.059 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200504/95 X-Sequence-Number: 20988 Tom Lane wrote: > The hypothetical mail-sending process > would presumably want to send mail and then delete the associated record > from the table of pending mails ... so what if it fails after sending > the mail and before committing the delete? > > What this does do for you is replace the risk of phantom emails (mail > sent but corresponding action inside the database never committed) > with the risk of duplicate emails (mail-sender sends you another one > after it restarts). In most cases I think I'd prefer the latter. You have this possibility anyway. If a mailserver thinks it has failed to forward the message, it will resend. There is always a small window where the receiving mailserver might actually have received the message without the acknowledgement being logged by the sender. -- Richard Huxton Archonet Ltd