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

Hi,

I have the short term problem of needing to know quite fast when someone updates or inserts a column in a table I have.
It'ssomething I hope to automate, but for now I've been looking around for a way to trigger a shell script to send me
anemail whenever this table is added to.  

I looked around on archives of over a year ago on this and other psql lists, and it all seemed to point to creating a
functionin C that is then added as a trigger to postgres. It seems strange to me that this little feature is not there,
butI don't mind coding in C, so I thought I'd give it a go.  

I even found a great reference to this: Bruce Momjan's book, specifically, the little section on "extending postgresql
inC". 

I followed this, created a little function that takes a char and returns the usual int, then I downloaded all of the
newestversion of postgresql, in response to http://www.ca.postgresql.org/docs/aw_pgsql_book/node170.html - and finally
issuedsome dubious compilation commands to make the dynamically linked c file (is this too much work for a seemingly
simpletask like this??), based on the headers I'd just downloaded : 

gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I/opt/downloads/postgresql-7.2.1/src/interfaces/libpq
-I/opt/downloads/postgresql-7.2.1/src/include/ -c -o alertme.o alertme.c 

and now I've tried the following command as user postgres, in psql:

create function alertme(char) returns int as '/home/ale/c/alertme.so' language 'C';

and it says "stat failed on file '/home/ale/play/alertme.so': Permission denied"

Permission? here are the file in question's permissions:
-rwxrwxrwx

That's more than's even safe... What am I doing wrong??

Thanks,

Ale


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

pgsql-general by date:

Previous
From: Jeff Davis
Date:
Subject: Re: hexadecimal values
Next
From: Tom Lane
Date:
Subject: Re: What popular, large commercial websites run