shortcircuit logic in plpsql

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: shortcircuit logic in plpsql
Date: 2006-07-19 03:12:40
Message-ID: e9k7va$lrg$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm trying to do this:

IF TG_OP = \'INSERT\' OR (TG_OP = \'UPDATE\' AND OLD.status <>
NEW.status) THEN

..but pg is complaining:

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

Does plpgsql not short circuit its logic?

=>select version();
version
---------------------------------------------------------------------------------------------------------
PostgreSQL 8.0.8 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2
20030222 (Red Hat Linux 3.2.2-5)
(1 row)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-07-19 03:29:49 Re: shortcircuit logic in plpsql
Previous Message Reid Thompson 2006-07-19 03:09:41 Re: postmaster: StreamConnection: accept: No such device