Re: Creating functions and triggers

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Fontenot, Paul" <Paul(dot)Fontenot(at)bannerhealth(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Creating functions and triggers
Date: 2003-05-07 19:18:35
Message-ID: 200305072018.35179.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-05-07 19:28:39 Re: Restoring 7.3.x Data on 7.2.x Database
Previous Message scott.marlowe 2003-05-07 19:17:42 Re: Restoring 7.3.x Data on 7.2.x Database