Re: the value of OLD on an initial row insert - Mailing list pgsql-sql

From Luca Ferrari
Subject Re: the value of OLD on an initial row insert
Date
Msg-id CAKoxK+4kHTX+29ddQAGhvzWzX7fYALyriu-mvQA5rB0WeHvvEw@mail.gmail.com
Whole thread Raw
In response to the value of OLD on an initial row insert  (James Sharrett <jsharrett@tidemark.net>)
List pgsql-sql
On Fri, Sep 20, 2013 at 6:43 PM, James Sharrett <jsharrett@tidemark.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



pgsql-sql by date:

Previous
From: Thomas Fanghaenel
Date:
Subject: Comparison semantics of CHAR data type
Next
From: jonathansfl
Date:
Subject: postgres subfunction return error