pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Davis <mdavis@sevainc.com>
To: 'Joseph Shraibman' <jks@selectacast.net>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: RE: 'record old is unassigned yet' when using trigger in 7.1.1
Date: Wed, 9 May 2001 15:58:44 -0600
Message-ID: <01C0D8A0.ED65E9A0.mdavis@sevainc.com> (raw)

When creating the trigger you need to specify BEFORE UPDATE rather than BEFORE INSERT.

-----Original Message-----
From:	Joseph Shraibman [SMTP:jks@selectacast.net]
Sent:	Wednesday, May 09, 2001 2:56 PM
To:	pgsql-sql@postgresql.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@selectacast.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@postgresql.org)




view thread (10+ messages)  latest in thread

Message-ID: <01C0D8A0.ED65E9A0.mdavis@sevainc.com>
Permalink:  ../01C0D8A0.ED65E9A0.mdavis@sevainc.com/
Also on:    postgresql.org/message-id/01C0D8A0.ED65E9A0.mdavis@sevainc.com

 · 

reply

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: mdavis@sevainc.com, jks@selectacast.net
  Subject: Re: 'record old is unassigned yet' when using trigger in 7.1.1
  In-Reply-To: <01C0D8A0.ED65E9A0.mdavis@sevainc.com>
  References: <01C0D8A0.ED65E9A0.mdavis@sevainc.com>

* 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