From: | Joseph Shraibman <jks(at)selectacast(dot)net> |
---|---|
To: | Joe Conway <jconway2(at)home(dot)com> |
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 22:25:23 |
Message-ID: | 3AF9C3D3.83DCAF85@selectacast.net |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Thanks, I sort of figured it out after I sent the email, but I'm still
working on it.
Joe Conway wrote:
>
> > 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.
>
> OLD doesn't exist on inserts, only on update and delete. If you want to use
> the same function for both insert and update use the TG_OP variable and an
> if statement. See
> http://www.postgresql.org/idocs/index.php?plpgsql-trigger.html
>
> Hope this helps,
>
> Joe
--
Joseph Shraibman
jks(at)selectacast(dot)net
Increase signal to noise ratio. http://www.targabot.com
From | Date | Subject | |
---|---|---|---|
Next Message | Roberto Mello | 2001-05-09 22:37:44 | Re: Information passing, Perl, Unix and Postgresql Database |
Previous Message | Michael Davis | 2001-05-09 21:58:44 | RE: 'record old is unassigned yet' when using trigger in 7.1.1 |