From: | Roman Neuhauser <neuhauser(at)sigpipe(dot)cz> |
---|---|
To: | Harpreet Dhaliwal <harpreet(dot)dhaliwal01(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Triggers invoking a stored procedure or a C function |
Date: | 2006-08-16 21:59:25 |
Message-ID: | 20060816215925.GF1172@dagan.sigpipe.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
# harpreet(dot)dhaliwal01(at)gmail(dot)com / 2006-08-16 11:55:39 -0400:
> Hi,
> Conventionally a trigger would fire a few sql queries on a particular event
> and we have standard code for that.
>
> My requirement is to start a stored procedure or a C function as a trigger
> action.
>
> Is this possible?
Besides the fact that PostgreSQL doesn't have stored procedures,
only "SQL-invoked routines", both SQL and external, you can.
After all,
http://www.postgresql.org/docs/8.1/static/sql-createtrigger.html
says
CREATE TRIGGER name { BEFORE | AFTER } { event [ OR ... ] }
ON table [ FOR [ EACH ] { ROW | STATEMENT } ]
EXECUTE PROCEDURE funcname ( arguments )
The above page also links to "33.4. A Complete Example"
(http://www.postgresql.org/docs/8.1/static/trigger-example.html)
which revolves around a trigger function written in C.
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
From | Date | Subject | |
---|---|---|---|
Next Message | Michelle Konzack | 2006-08-16 22:22:26 | Re: User can not more login |
Previous Message | Harpreet Dhaliwal | 2006-08-16 21:58:58 | Re: [NOVICE] DB insert Error |