Re: Problem with function and trigger...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ian Meyer <ianmmeyer(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Problem with function and trigger...
Date: 2005-09-28 17:52:48
Message-ID: 7747.1127929968@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Ian Meyer <ianmmeyer(at)gmail(dot)com> writes:
> IF TG_OP = 'DELETE' AND OLD.deleted = FALSE THEN

> ERROR: record "old" is not assigned yet
> DETAIL: The tuple structure of a not-yet-assigned record is indeterminate.
> CONTEXT: PL/pgSQL function "thread_sync" line 2 at if

> What am I failing to understand with this?

We don't guarantee short-circuit evaluation of boolean expressions.
You'll have to break that into two IFs, ie,

IF TG_OP = 'DELETE' THEN
IF ... test on OLD.something ...

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Axel Rau 2005-09-28 19:19:25 Selecting count of details along with details columns
Previous Message Ian Meyer 2005-09-28 17:35:09 Problem with function and trigger...