pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedPgsql conditions do not short circuit?
3+ messages / 2 participants
[nested] [flat]
* Pgsql conditions do not short circuit?
@ 2005-02-11 00:54 Guy Rouillier <guyr@masergy.com>
0 siblings, 1 reply; 3+ messages in thread
From: Guy Rouillier @ 2005-02-11 00:54 UTC (permalink / raw)
To: pgsql-interfaces
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?
--
Guy Rouillier
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Pgsql conditions do not short circuit?
@ 2005-02-11 01:48 Peter Eisentraut <peter_e@gmx.net>
parent: Guy Rouillier <guyr@masergy.com>
0 siblings, 0 replies; 3+ messages in thread
From: Peter Eisentraut @ 2005-02-11 01:48 UTC (permalink / raw)
To: Guy Rouillier <guyr@masergy.com>; +Cc: 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/
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Pgsql conditions do not short circuit?
@ 2005-02-11 04:18 Guy Rouillier <guyr@masergy.com>
0 siblings, 0 replies; 3+ messages in thread
From: Guy Rouillier @ 2005-02-11 04:18 UTC (permalink / raw)
To: pgsql-interfaces
Peter Eisentraut wrote:
>
> That is true, but it wouldn't have helped you anyway, because the
> error is caught during the semantic analysis before the execution
> phase.
Thanks, Peter. Now that I understand the rules, I can follow them.
--
Guy Rouillier
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-02-11 04:18 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-02-11 00:54 Pgsql conditions do not short circuit? Guy Rouillier <guyr@masergy.com>
2005-02-11 01:48 ` Peter Eisentraut <peter_e@gmx.net>
2005-02-11 04:18 Re: Pgsql conditions do not short circuit? Guy Rouillier <guyr@masergy.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox