From: Jeff Eckermann <jeff_eckermann@yahoo.com>
To: Susan Hoddinott <susan@perth.dialix.com.au>
To: pgsql-sql@postgresql.org
Subject: Re: Executing SQL commands via triggers without the use of procedures
Date: Sat, 1 Mar 2003 08:35:51 -0800 (PST)
Message-ID: <20030301163551.66721.qmail@web20809.mail.yahoo.com> (raw)
In-Reply-To: <001501c2def2$fe2fe9c0$1f84fea9@oemcomputer>
--- 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/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jeff_eckermann@yahoo.com, susan@perth.dialix.com.au
Subject: Re: Executing SQL commands via triggers without the use of procedures
In-Reply-To: <20030301163551.66721.qmail@web20809.mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox