Re: How to execute external script from a TRIGGER or FUNCTION ?

From: Denis BUCHER <dbucherml(at)hsolutions(dot)ch>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to execute external script from a TRIGGER or FUNCTION ?
Date: 2009-08-01 15:47:32
Message-ID: 4A746394.1060101@hsolutions.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

Denis BUCHER a écrit :
> I need to execute an external script from Postgresql, it could be in
> perl, in bash/shell, in whatever...
>
> Any help would be appreciated ! I just need a very simple example if
> possible...
>
> I already searched on the web but found nothing...

After hours of search, I searched just some more and I think I found the
solution, hope it can be useful to someone else :

CREATE LANGUAGE plperlu;

CREATE FUNCTION test_perl_external (integer) RETURNS boolean AS $$
$filename = '/tmp/somefile';
if (-e $filename) { return true; }
return false;
$$ LANGUAGE plperlu;

SELECT test_perl_external(1);

Denis

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jennifer Trey 2009-08-01 16:25:44 Re: Can I have a look at your TuningWizard generated config file?
Previous Message Denis BUCHER 2009-08-01 15:47:21 How to execute external script from a TRIGGER or FUNCTION ?