Re: Best way to use trigger to email a report ? - Mailing list pgsql-general

From AC Gomez
Subject Re: Best way to use trigger to email a report ?
Date
Msg-id CABtmK-i20-qGPe=qG3F2FV3ir6caLzgh1ipi1znB7f5uBdNjOg@mail.gmail.com
Whole thread Raw
In response to Re: Best way to use trigger to email a report ?  (Tim Clarke <tim.clarke@minerva.info>)
List 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.clarke@minerva.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@minerva.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.

pgsql-general by date:

Previous
From: Support
Date:
Subject: Re: pg_basebackup cannot compress to STDOUNT
Next
From: Mariya Rampurawala
Date:
Subject: PostgreSQL-12 replication failover, pg_rewind fails