Re: PL/Perl 64-bit and sending emails

From: Steve Atkins <steve(at)blighty(dot)com>
To: pgsql-general List <pgsql-general(at)postgresql(dot)org>
Subject: Re: PL/Perl 64-bit and sending emails
Date: 2009-09-03 19:10:59
Message-ID: A8EDE3D3-AD75-44BD-9AB5-CE23EF50A2F5@blighty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Sep 3, 2009, at 11:30 AM, Mark Lubratt wrote:

> Hello!
>
> I've been running the 64-bit version of 8.3.4 on OpenSolaris 2009.06
> for over a year. Now, I need to put a perl function call into it to
> allow emails to be sent by the database backend. I tried installing
> plperl, but it looks like only a 32-bit version is available. Does
> the 64-bit version of plperl exist? Or, does someone know of
> another way to get the backend to send an email?

Have a queue table in the database you put your emails into and an
external process that polls the table, sends the email and deletes the
entry from the queue. Apart from avoiding the ickiness of doing high
latency work from a database function this also makes sending email
transaction safe - if the transaction rolls back after "sending" the
email, the email doesn't get sent.

Using listen/notify based on a trigger on the table makes it a little
more responsive.

This comes up fairly often. It's probably worth doing a tidy perl
daemon to handle it and stashing it up on pgfoundry.

Cheers,
Steve

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andy Colson 2009-09-03 19:16:21 Re: easy task: concurrent select-updates
Previous Message Alvaro Herrera 2009-09-03 19:08:36 Re: Create language PLPERL error