Re: Running OS-level programs from Postgres?

From: Philip Hallstrom <postgresql(at)philip(dot)pjkh(dot)com>
To: Sean Murphy <Sean(dot)Murphy(at)equipoint(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Running OS-level programs from Postgres?
Date: 2007-06-20 20:04:53
Message-ID: 20070620130228.E65171@bravo.pjkh.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> 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?
>
> 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.

I've never done it, and while you can do it with the various pl languages,
you might also look into the notice/listen stuff.

That way your app doesn't have to wait for the process to finish, but can
send a notice which another server side app can listen for and do whatever
it needs to do.

http://www.postgresql.org/docs/current/static/sql-notify.html
http://www.postgresql.org/docs/current/static/sql-listen.html

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2007-06-20 20:09:30 Re: Running OS-level programs from Postgres?
Previous Message Steve Atkins 2007-06-20 19:55:23 Re: Running OS-level programs from Postgres?