Re: How to execute external script from a TRIGGER or FUNCTION ? - Mailing list pgsql-general

From Denis BUCHER
Subject Re: How to execute external script from a TRIGGER or FUNCTION ?
Date
Msg-id 4A746394.1060101@hsolutions.ch
Whole thread Raw
In response to How to execute external script from a TRIGGER or FUNCTION ?  (Denis BUCHER <dbucherml@hsolutions.ch>)
Responses Re: How to execute external script from a TRIGGER or FUNCTION ?
Re: How to execute external script from a TRIGGER or FUNCTION ?
List 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


pgsql-general by date:

Previous
From: Denis BUCHER
Date:
Subject: How to execute external script from a TRIGGER or FUNCTION ?
Next
From: Jennifer Trey
Date:
Subject: Re: Can I have a look at your TuningWizard generated config file?