From: Jan Wieck <JanWieck@Yahoo.com>
To: Cedar Cox <cedarc@visionforisrael.com>
Cc: Norbert Schollum <schollum@equinux.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: Functions and Triggers
Date: Tue, 27 Mar 2001 04:59:05 -0500 (EST)
Message-ID: <200103270959.EAA26759@jupiter.jw.home> (raw)
In-Reply-To: <Pine.LNX.4.21.0103261537500.842-100000@nanu.visionforisrael.com>
Cedar Cox wrote:
>
> CREATE FUNCTION lastupdated() RETURNS opaque AS '
> begin
> new.last_updated := CURRENT_TIMESTAMP;
> return new;
> end;
> ' LANGUAGE 'plpgsql';
>
> CREATE TRIGGER trigname BEFORE INSERT OR UPDATE on tblname
> FOR EACH ROW EXECUTE PROCEDURE lastupdated();
>
> Note: you could use now() instead of CURRENT_TIMESTAMP
>
> Note2: on a BEFORE trigger you must return new or old. If you return null
> the statement will be aborted. (?)
If you return NULL from a BEFORE trigger the action on that
particular row will be silently suppressed.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.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: JanWieck@Yahoo.com, cedarc@visionforisrael.com, schollum@equinux.de
Subject: Re: Functions and Triggers
In-Reply-To: <200103270959.EAA26759@jupiter.jw.home>
* 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