On Wednesday 07 May 2003 5:32 pm, Fontenot, Paul wrote:
> Is there a good, hold your hand type of tutorial or howto on creating
> functions and triggers and using them together? I'm learning PostgreSQL
> after spending years with MySQL and the information at
> techdocs.postgresql.org - while good, is a little deep for me right now.
> Specificly I would like to be able to read something that will tell me
> how to create a function that will can run a shell script when certain
> words are entered into a record. Thanks for your time and guidance.
[blowing own trumpet]
Try the "Postgresql Notes" (Automating Processes section)
http://techdocs.postgresql.org/ (Quick Reference Material)
or
"A Brief Real-World Trigger Example"
http://techdocs.postgresql.org/guides/
Both the above cover creating a plpgsql function and a trigger to call it. The
first is older, but simpler.
If you really want to call a shell script, check the mailing list archives and
search for "shell" or "bash":
http://archives.postgresql.org/
You'll also want to read up on pl/sh (or whatever it's called) - procedural
shell stuff. Also perhaps look into pl/perl.
I'd probably recommend having a long-lasting process LISTEN for NOTIFY
messages rather than directly running shell scripts.
--
Richard Huxton