Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 956A8633D1B for ; Tue, 11 Aug 2009 19:36:03 -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 81304-09 for ; Tue, 11 Aug 2009 22:36:00 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from cirrus.hsolutions.ch (cirrus.hsolutions.ch [212.203.66.103]) by mail.postgresql.org (Postfix) with ESMTP id 5511D6339BF for ; Tue, 11 Aug 2009 19:36:00 -0300 (ADT) Received: from [127.0.0.1] (unknown [78.234.64.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by cirrus.hsolutions.ch (Postfix) with ESMTPSA id 1C115790001; Wed, 12 Aug 2009 00:39:01 +0200 (CEST) Message-ID: <4A81F244.9070402@hsolutions.ch> Date: Wed, 12 Aug 2009 00:35:48 +0200 From: Denis BUCHER Organization: Horus Digital Solutions =?UTF-8?B?U8Ogcmw=?= User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: Jan Verheyden CC: "'pgsql-sql@postgresql.org'" Subject: Re: mail alert References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/52 X-Sequence-Number: 32961 Hello, Jan Verheyden a écrit : > I was looking in what way it’s possible to alert via mail when some > conditions are true in a database. a) If the alert is not "very urgent" i.e. you can alter some minutes later I would do it like this : 1. Create a function that returns what you need, most importantly if the conditions are met 2. Create a script that does something like "SELECT * FROM function()..." b) If the email should be sent immediately, you could create a perl function in the database, launched by a TRIGGER and launching an "external" script... Therefore, first you have to know the requirements... Denis