From: | Michael Davis <mdavis(at)sevainc(dot)com> |
---|---|
To: | "'Joseph Shraibman'" <jks(at)selectacast(dot)net>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | RE: 'record old is unassigned yet' when using trigger in 7.1.1 |
Date: | 2001-05-09 21:58:44 |
Message-ID: | 01C0D8A0.ED65E9A0.mdavis@sevainc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
When creating the trigger you need to specify BEFORE UPDATE rather than BEFORE INSERT.
-----Original Message-----
From: Joseph Shraibman [SMTP:jks(at)selectacast(dot)net]
Sent: Wednesday, May 09, 2001 2:56 PM
To: pgsql-sql(at)postgresql(dot)org
Subject: 'record old is unassigned yet' when using trigger in 7.1.1
I have a function used in a trigger that looks like this:
begin
IF OLD.status <> NEW.status
THEN
NEW.statchangedate = CURRENT_DATE;
END IF;
return NEW;
end;
The problem is when a new row is inserted I get this error message:
ERROR: record old is unassigned yet
... and the insert fails.
It doesn't matter if the trigger is before or after.
--
Joseph Shraibman
jks(at)selectacast(dot)net
Increase signal to noise ratio. http://www.targabot.com
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
From | Date | Subject | |
---|---|---|---|
Next Message | Joseph Shraibman | 2001-05-09 22:25:23 | Re: 'record old is unassigned yet' when using trigger in 7.1.1 |
Previous Message | Joe Conway | 2001-05-09 21:55:48 | Re: 'record old is unassigned yet' when using trigger in 7.1.1 |