From: | "Joe Conway" <jconway2(at)home(dot)com> |
---|---|
To: | "Joseph Shraibman" <jks(at)selectacast(dot)net> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: 'record old is unassigned yet' when using trigger in 7.1.1 |
Date: | 2001-05-09 23:49:33 |
Message-ID: | 00c201c0d8e2$b3706530$54d410ac@jecw2k1 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> ... 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
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2001-05-09 23:55:29 | Re: 'record old is unassigned yet' when using trigger in 7.1.1 |
Previous Message | Joseph Shraibman | 2001-05-09 23:44:03 | Re: 'record old is unassigned yet' when using trigger in 7.1.1 |