Re: the value of OLD on an initial row insert

From: Luca Ferrari <fluca1978(at)infinito(dot)it>
To: James Sharrett <jsharrett(at)tidemark(dot)net>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: the value of OLD on an initial row insert
Date: 2013-09-23 06:45:51
Message-ID: CAKoxK+4kHTX+29ddQAGhvzWzX7fYALyriu-mvQA5rB0WeHvvEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Sep 20, 2013 at 6:43 PM, James Sharrett <jsharrett(at)tidemark(dot)net> wrote:

> ERROR: record "old" is not assigned yet
> SQL state: 55000
> Detail: The tuple structure of a not-yet-assigned record is indeterminate.
>
> Is this what's happening? If so, how can I avoid the issue.

If I get it right you are running the trigger also for an insert,
which of course does not have an old value. You should either set the
trigger to run only on update statements or enforce your check to see
if the trigger has been invoked for something different than insert
statements.

Luca

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message jonathansfl 2013-09-25 23:11:17 postgres subfunction return error
Previous Message Thomas Fanghaenel 2013-09-23 00:51:26 Comparison semantics of CHAR data type