Thread: Executing external scripts

Executing external scripts

From
Mark Jewiss
Date:
Hello,

I've been doing some reading through the documentation and the archives of
this list but have not got very far yet.

I want to be able to create a trigger that when fired will execute an
external script. I may require arguments to be passed to the script from
the trigger.

I can't find a definate yes/no as to whether this can actually be done or
not in Postgresql 6.5.* - does anybody know?

Looking over the functions section, I might be able to do what I need to
do using one of the languages. However, I don't know C, and it does not
apply to what I'm doing anyway. I need to use Perl, but this means writing
a procedural language handler, which has to be done in C, which I don't
really know..... :(

Has anybody written, or knows of the existence of, a PL for Perl for
Postgresql?

Regards,

Mark.
--
Mark Jewiss
Knowledge Matters Limited
http://www.knowledge.com


Re: [GENERAL] Executing external scripts

From
Date:
you did not study the archive hard enough ;-) somebody answered your
question days ago:
no PL for perl. you can use system() (in C) to
hack perl into c. in short, you need to learn c, just a little bit
(ask a c guy for help). -- or has somebody already done this before,
could you send the example code to the listing? thanks!

Kai

On Tue, 30 Nov 1999, Mark Jewiss wrote:

> Hello,
>
> I've been doing some reading through the documentation and the archives of
> this list but have not got very far yet.
>
> I want to be able to create a trigger that when fired will execute an
> external script. I may require arguments to be passed to the script from
> the trigger.
>
> I can't find a definate yes/no as to whether this can actually be done or
> not in Postgresql 6.5.* - does anybody know?
>
> Looking over the functions section, I might be able to do what I need to
> do using one of the languages. However, I don't know C, and it does not
> apply to what I'm doing anyway. I need to use Perl, but this means writing
> a procedural language handler, which has to be done in C, which I don't
> really know..... :(
>
> Has anybody written, or knows of the existence of, a PL for Perl for
> Postgresql?
>
> Regards,
>
> Mark.
> --
> Mark Jewiss
> Knowledge Matters Limited
> http://www.knowledge.com
>
>
> ************
>


Re: [GENERAL] Executing external scripts

From
Peter Eisentraut
Date:
On Tue, 30 Nov 1999, Mark Jewiss wrote:

> I want to be able to create a trigger that when fired will execute an
> external script. I may require arguments to be passed to the script from
> the trigger.
>
> I can't find a definate yes/no as to whether this can actually be done or
> not in Postgresql 6.5.* - does anybody know?

The definite answer to this is no, not straightforwardly. You will have to
write a C wrapper function.

While this sure sounds like a neat feature to have, I think there are too
many potential headaches.

--
Peter Eisentraut                  Sernanders vaeg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden