From: Joe Conway <jconway2@home.com>
To: Joseph Shraibman <jks@selectacast.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: 'record old is unassigned yet' when using trigger in 7.1.1
Date: Wed, 9 May 2001 16:49:33 -0700
Message-ID: <00c201c0d8e2$b3706530$54d410ac@jecw2k1> (raw)
References: <3AF9AECE.DE93E098@selectacast.net>
<000c01c0d8d2$cefddf90$54d410ac@jecw2k1>
<3AF9D542.88C9FACD@selectacast.net>
> ... but that had the same problem. So then I tried:
>
> create function utbl_set_statchangedate() returns opaque as
> 'begin
> IF TG_OP = \'UPDATE\'
> THEN
> NEW.statchangedate := CURRENT_DATE;
> ELSE IF OLD.status <> NEW.status
> THEN
> NEW.statchangedate := CURRENT_DATE;
> END IF;
> return NEW;
> end;
> ' language 'plpgsql';
There is no "else if" in plpgsql, if I remember correctly. Try:
create function utbl_set_statchangedate() returns opaque as
'begin
IF TG_OP = ''UPDATE'' THEN
NEW.statchangedate := CURRENT_DATE;
ELSE
IF OLD.status <> NEW.status THEN
NEW.statchangedate := CURRENT_DATE;
END IF;
END IF;
return NEW;
end;
' language 'plpgsql';
-- Joe
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: jconway2@home.com, jks@selectacast.net
Subject: Re: 'record old is unassigned yet' when using trigger in 7.1.1
In-Reply-To: <00c201c0d8e2$b3706530$54d410ac@jecw2k1>
References: <3AF9AECE.DE93E098@selectacast.net> <000c01c0d8d2$cefddf90$54d410ac@jecw2k1> <3AF9D542.88C9FACD@selectacast.net> <00c201c0d8e2$b3706530$54d410ac@jecw2k1>
* 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