Re: Best way to use trigger to email a report ?

From: AC Gomez <antklc(at)gmail(dot)com>
To: Tim Clarke <tim(dot)clarke(at)minerva(dot)info>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Best way to use trigger to email a report ?
Date: 2020-05-09 17:31:38
Message-ID: CABtmK-i20-qGPe=qG3F2FV3ir6caLzgh1ipi1znB7f5uBdNjOg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

We're posting a flag to a table. The table has an "event" field. When we
post the value "email" into that field, a sweeper app that runs on a
schedule looks for this flag, then takes the value in the message field and
sends that out as an email.

On Sat, May 9, 2020, 12:31 PM Tim Clarke <tim(dot)clarke(at)minerva(dot)info> wrote:

> Personally I'd have your trigger put the necessary data into a queue to
> run the report then have some other process take that data off
> asynchronously. Either pop it in a table and do it yourself or use a robust
> distributed broker protocol platform like RabbitMQ or Apache ActiveMQ or
> Kafka.
> Tim Clarke MBCS
> IT Director
> Direct: +44 (0)1376 504510 | Mobile: +44 (0)7887 563420
>
> On 08/05/2020 17:26, David Gauthier wrote:
>
> psql (9.6.0, server 11.3) on linux
>
> Looking for ideas. I want a trigger to...
> 1) compose an html report based on DB content
> 2) email the report to a dist list (dl = value of a table column)
>
> If this will involve hybrid coding, I prefer PL/perl. The linux env has
> both "mail" and "mutt" (if this is of any help).
>
> The idea is to send a report to the list when all the data has been
> collected for a particular job and the final status of the job is updated
> as a col of a rec of a certain table. Probably a post update trigger.
>
> Thanks for any ideas :-)
>
>
>
>
>
> Telephone: Witham: +44(0)1376 503500 | London: +44 (0)20 3009 0853 |
> Frankfurt: +49 (0)69 7191 6000 | Hong Kong: +852 5803 1687 | Toronto: +1
> 647 503 2848
> Web: https://www.manifest.co.uk/
>
>
>
> Minerva Analytics Ltd - A Solactive Company
> 9 Freebournes Court | Newland Street | Witham | Essex | CM8 2BL | United
> Kingdom
>
> ------------------------------
>
> Copyright: This e-mail may contain confidential or legally privileged
> information. If you are not the named addressee you must not use or
> disclose such information, instead please report it to admin(at)minerva(dot)info
> Legal: Minerva Analytics is the trading name of: Minerva Analytics Ltd:
> Registered in England Number 11260966 & The Manifest Voting Agency Ltd:
> Registered in England Number 2920820 Registered Office at above address.
> Please Click Here https://www.manifest.co.uk/legal/ for further
> information.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mariya Rampurawala 2020-05-10 09:25:38 PostgreSQL-12 replication failover, pg_rewind fails
Previous Message Support 2020-05-09 10:13:19 Re: pg_basebackup cannot compress to STDOUNT