Re: making a trigger to a system call to a shell script - Mailing list pgsql-general

From Alejandro Fernandez
Subject Re: making a trigger to a system call to a shell script
Date
Msg-id 20020503095134.62de0e19.ale@e-group.org
Whole thread Raw
In response to Re: making a trigger to a system call to a shell script  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: making a trigger to a system call to a shell script
List pgsql-general

Thanks for the suggestions. I put it in /usr/lib/pgsql and now it's getting taken. I used the command

create function alertme(varchar(100)) returns int as '/usr/lib/pgsql/alertme.so' language 'C';

This seemed to work: it returned "CREATE"

Then commands like:
select alertme('This is not an exercise!');

would send me an email, although there seems to be a problem with the types, because it takes a char * as an argument,
butI couldn't find a list of types for postgresql functions, so the email it sends always contains one symbol (pi for
stringsand 3/4ths symbol for integers or chars), can't cut and paste it to show...). 

Anyway, last step was to create a trigger so that I could monitor changes to my table remotely:

create trigger trigger_alertme
before insert or update on mytable for each row execute procedure alertme('blablabla');

And this will not work: it returns:

ERROR:  CreateTrigger: function alertme() does not exist

Any idea where to go from here?

Thanks again! - I think this is quite a frequent wish by many people, as I've seen the question "how do I trigger an
outsidescript" crop up unanswered quite a few times in the archives. I did get the email about the sourceforge project
-thanks a lot! - but I'm so far into this, I'd like to get to the bottom of it first! (Yes, and meanwhile I'm using
cron- thanks!). 

Ale


On Thu, 02 May 2002 17:46:13 -0400
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Alejandro Fernandez <ale@e-group.org> writes:
> > and it says "stat failed on file '/home/ale/play/alertme.so': Permission denied"
>
> > Permission? here are the file in question's permissions:
> > -rwxrwxrwx
>
> How about permissions on the directories in the path?
>
>             regards, tom lane


--
Alejandro Fernandez
Electronic Group Interactive
--+34-65-232-8086--

pgsql-general by date:

Previous
From: Vaclav Kulakovsky
Date:
Subject: Re: Data integrity problem !!!
Next
From: Holger Marzen
Date:
Subject: Re: Subject: bool / vacuum full bug followup