Re: Executing SQL commands via triggers without the use of procedures - Mailing list pgsql-sql

From Jeff Eckermann
Subject Re: Executing SQL commands via triggers without the use of procedures
Date
Msg-id 20030301163551.66721.qmail@web20809.mail.yahoo.com
Whole thread Raw
In response to Executing SQL commands via triggers without the use of procedures  ("Susan Hoddinott" <susan@perth.dialix.com.au>)
List pgsql-sql
--- Susan Hoddinott <susan@perth.dialix.com.au> wrote:
> Hello,
> 
> Having scoured the relevant documentation I cannot
> find anything which indicates how I simply create a
> database trigger to insert into a second table after
> insert on a first table, without the use of a
> procedure.  As I do not want return values etc. this
> seems like overkill.  Is it possible to create a
> trigger which executes SQL directly without the need
> to create a procedure?  If so, what is the syntax?
> 

You don't need to worry about those return values;
nothing will be returned to your application from a
trigger function.  AFAICT the only difference between
PostgreSQL and other DBMSs is that (at least some)
others put the procedural logic inside the "create
trigger" statement, whereas PostgreSQL puts it in a
separate function.  You need to think about this only
at statement creation time; otherwise everything works
just the same.  One tip: always use the "create or
replace function" syntax, to avoid having your trigger
become confused if you change your function definition.

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/


pgsql-sql by date:

Previous
From: Edmund Lian
Date:
Subject: Re: Denormalizing during select
Next
From: Tom Lane
Date:
Subject: Re: Epoch extraction