X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C9E439DC81A for ; Tue, 27 Dec 2005 13:41:20 -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 56383-08 for ; Tue, 27 Dec 2005 13:41:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 8F7FF9DC80C for ; Tue, 27 Dec 2005 13:41:18 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id jBRHfFj5005468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 27 Dec 2005 10:41:18 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBRHfFlj070382; Tue, 27 Dec 2005 10:41:15 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBRHfEBR070381; Tue, 27 Dec 2005 10:41:14 -0700 (MST) (envelope-from mfuhr) Date: Tue, 27 Dec 2005 10:41:14 -0700 From: Michael Fuhr To: Aftab Alam Cc: "'postgre'" Subject: Re: sending mail from Postgres Message-ID: <20051227174114.GA70280@winnie.fuhr.org> References: <002c01c60abf$4acb3320$cd00000a@amiindiahjwbgh> <000401c60ac5$f3896260$ec1010ac@aftabn463> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000401c60ac5$f3896260$ec1010ac@aftabn463> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.047 required=5 tests=[AWL=0.047] X-Spam-Score: 0.047 X-Spam-Level: X-Archive-Number: 200512/323 X-Sequence-Number: 20043 On Tue, Dec 27, 2005 at 02:44:32PM +0530, Aftab Alam wrote: > How can i send mail form postgresql. You could write a function in a language like plperlu, pltclu, or plpython, but a problem with functions that have effects outside the database is that those effects can't be undone if the transaction rolls back. A common example is a trigger that sends email when a table is changed: if the trigger fires and then you roll back the transaction, it's too late to cancel the email. Depending on what you're doing it might be better to use LISTEN/NOTIFY and have a client program send email when it receives a notification (notifications are sent only when the transaction commits). -- Michael Fuhr