Re: Logical expn not shortcircuiting in trigger function?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joel Burton <jburton(at)scw(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Logical expn not shortcircuiting in trigger function?
Date: 2001-04-20 15:01:16
Message-ID: 26356.987778876@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Joel Burton <jburton(at)scw(dot)org> writes:
> If I try to INSERT into this table, I get
> ERROR: record old is unassigned yet
> So, why hasn't the logic short-circuited? Am I missing something?

You lose because those are parameters that plpgsql has to hand to the
SQL expression evaluator. The expression evaluator might have
short-circuited that part of the expression when it ran it, but it never
gets to run it; plpgsql errors out while setting up for the expression
eval.

I think you'll have to split this into multiple IF statements if you
want to make it work like that. Possibly better: use separate trigger
functions for the INSERT and UPDATE cases to begin with.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lonnie Cumberland 2001-04-20 15:04:26 Client/Server Security question
Previous Message Tom Lane 2001-04-20 14:26:18 Re: Database Connect