Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id CE2E2635688 for ; Thu, 13 Aug 2009 19:24:26 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 71961-06-2 for ; Thu, 13 Aug 2009 22:24:23 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mail.postgresql.org (Postfix) with ESMTP id 0F752635441 for ; Thu, 13 Aug 2009 19:24:23 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MbiiY-0001rz-RI for pgsql-sql@postgresql.org; Thu, 13 Aug 2009 22:24:18 +0000 Received: from e177123205.adsl.alicedsl.de ([85.177.123.205]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 13 Aug 2009 22:24:18 +0000 Received: from tim by e177123205.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 13 Aug 2009 22:24:18 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Tim Landscheidt Subject: Re: mail alert Date: Thu, 13 Aug 2009 22:24:07 +0000 Organization: Lines: 38 Message-ID: References: <20090813215420.GU5909@alvh.no-ip.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e177123205.adsl.alicedsl.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:EaCg4d9Hcc1/WFx6NcoFaVGVBmY= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1 X-Spam-Level: X-Archive-Number: 200908/71 X-Sequence-Number: 32980 Alvaro Herrera wrote: >> > It's on Windows >> I'd go with notify and a listener written in C using c-client to send >> emails, but only because I've used those before. > I wouldn't write it in C but rather Perl or Python, but whatever suits > your fancy should work (Visual Basic anyone?). The advantages to using > a listener program instead of doing it in a trigger or something like > that are: > - transaction semantics are kept; you don't send an email only to find > out your transaction has been rolled back for whatever reason, and then > send a second email when the transaction is replayed > - you don't block the database system just because your mail server is > down > - the email can be sent on whatever schedule fits the listener program > - the listener client can run elsewhere, not only in the database server > - any further external processing can take place at that time, without > bothering the database server > - other stuff I don't recall ATM The main disadvantage in using a listener is that it is your responsibility to make sure that the listener is listening 24/7 - from before the database accepts other connections, through network failures, bugs, etc. - otherwise notifica- tions will be lost. Therefore I find it much more reliable (and easier to program) to copy the relevant data to a table "mailqueue" (or whatever) and then process that queue every other minute. Tim