Re: BUG #12273: CASE Expression BUG

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #12273: CASE Expression BUG
Date: 2014-12-18 21:14:26
Message-ID: 4028.1418937266@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Thu, Dec 18, 2014 at 1:33 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> That's why that isn't the example ;-). In this case, since the WHEN is a
>> constant, the constant-expression simplifier itself figures out that it
>> can throw away the THEN expression and replace the whole CASE with the
>> ELSE expression. So it doesn't bother const-simplifying the THEN, hence
>> no error.

> Is the example with the "WITH" CTE too involved to use instead?

Doesn't seem like it really adds anything.

>> Meh. The same principle applies in other languages too, so I don't think
>> your wording is an improvement.

> Your's just didn't read that well to me...though the overall content was
> good. Maybe drop "Thus" and just lead with "Within PL/pgSQL functions, for
> example, using an IF [...]"

OK.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2014-12-18 21:20:05 Re: BUG #12275: configure incorrectly tests libxml2 version
Previous Message David Johnston 2014-12-18 21:12:05 Re: BUG #12273: CASE Expression BUG