Re: Pgsql conditions do not short circuit?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "Guy Rouillier" <guyr(at)masergy(dot)com>
Cc: "PostgreSQL Interfaces" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: Pgsql conditions do not short circuit?
Date: 2005-02-11 01:48:41
Message-ID: 200502110248.41720.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Guy Rouillier wrote:
> I have the following condition in a trigger function:
>
> IF (TG_OP = 'INSERT') OR (TG_OP = 'UPDATE' AND NEW.aggregate_flag
> != OLD.aggregate_flag)
>
> When I cause this trigger to execute on an insert, it complains that
> OLD is not defined yet. If I reformat this so I check the last
> condition in an IF nested in the "UPDATE" case, it works fine. From
> this, I'm concluding that pgsql conditions do not short circuit?

That is true, but it wouldn't have helped you anyway, because the error
is caught during the semantic analysis before the execution phase.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Guy Rouillier 2005-02-11 04:18:00 Re: Pgsql conditions do not short circuit?
Previous Message Guy Rouillier 2005-02-11 00:54:17 Pgsql conditions do not short circuit?