Re: Running OS-level programs from Postgres?

Поиск
Список
Период
Сортировка
От Steve Atkins
Тема Re: Running OS-level programs from Postgres?
Дата
Msg-id 769F9CF7-CAA9-4817-A1A9-F7C50B83FCA1@blighty.com
обсуждение исходный текст
Ответ на Running OS-level programs from Postgres?  (Sean Murphy <Sean.Murphy@equipoint.com>)
Ответы Re: Running OS-level programs from Postgres?  (Andrew Sullivan <ajs@crankycanuck.ca>)
Список pgsql-general
On Jun 20, 2007, at 12:07 PM, Sean Murphy wrote:

> Maybe this is a well duh kind of question, or maybe there's no
> straightforward way to do it, but is there any way that I could have a
> pg function initiate a process on the host system?

You can use pl/perlu or any of the other untrusted languages for
that.

>
> Specifically I'd like to script an email to send off on an insert
> trigger, but the ability to initiate system processes in general seems
> like it would come in handy.
>
> My present need is for email notification; if there's a pg function or
> module that would handle this (I haven't turned up anything in my
> searches, but maybe I'm using the wrong search terms in the wrong
> places) I'd be OK for now, but I'd rather have the flexibility of
> starting whatever process a given circumstance calls for.

Another approach, and one that can be more robust in the case
of external failures, is to have the trigger put the message it wants
to send into a queue table and have an external process that
monitors the table (via polling or listen/notify) and sends the
queued mail.

Cheers,
   Steve


В списке pgsql-general по дате отправления:

Предыдущее
От: Raymond O'Donnell
Дата:
Сообщение: Re: persistent db connections in PHP
Следующее
От: Philip Hallstrom
Дата:
Сообщение: Re: Running OS-level programs from Postgres?