Re: boolean short-circuiting in plpgsql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kev <kevinjamesfield(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: boolean short-circuiting in plpgsql
Date: 2008-07-31 06:39:42
Message-ID: 757.1217486382@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Kev <kevinjamesfield(at)gmail(dot)com> writes:
> ...because the case should force it to only evaluate 'old' when TG_OP
> = 'UPDATE' and otherwise ('INSERT') skip through to 't'. But this
> causes the same error on insert. I suspect it's because the select
> query gets parameterized and at that point the 'old' is missing,
> before the case even gets to be parsed.

Got it in one.

> How do I get around this
> without having two 'perform' statements?

What you need is two nested IF statements. The PERFORM in your example
is not relevant to the problem.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2008-07-31 06:51:02 Re: archive_timeout, checkpoint_timeout
Previous Message Tom Lane 2008-07-31 05:34:04 Re: Shared object "libpq.so.3" not found