Re: BUG #14363: CASE against a literal value produces correct against, same expression against a column null doesn't

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: hcate3(at)gmail(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14363: CASE against a literal value produces correct against, same expression against a column null doesn't
Date: 2016-10-10 19:47:55
Message-ID: CAKFQuwYrUqOTdzaEQA_D5e=+5bbJAKCwb0cSjKQor3R46c=joA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Oct 10, 2016 at 11:56 AM, <hcate3(at)gmail(dot)com> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 14363
> Logged by: Henry Cate
> Email address: hcate3(at)gmail(dot)com
> PostgreSQL version: 9.5.2
> Operating system: x86_64-pc-linux-gnu
> Description:
>
>
> ybd_test=# select version();
> version
>
> ------------------------------------------------------------
> --------------------------------------------------------
> PostgreSQL 9.5.2 on x86_64-pc-linux-gnu, compiled by clang version
> 3.8.0-2ubuntu3 (tags/RELEASE_380/final), 64-bit
>

​Same result in 9.3.12

​It seems like "case" is too complex an expression to be embedded into the
<..."simple" form of CASE expression...>

SELECT
case (
case decimal_9_1
when decimal_18_1 then 0
when decimal_9_1 then 1
end
)
when 1 then 2
when 0 then 3
end

https://www.postgresql.org/docs/9.5/static/functions-conditional.html

I suspect this is some kind of long-standing bug that hasn't been seen due
to this being a unusual way to write a case expression - mainly since the
embedded case evaluates correctly if it is done as a top-level expression.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Vitaly Burovoy 2016-10-10 20:09:19 Re: BUG #14363: CASE against a literal value produces correct against, same expression against a column null doesn't
Previous Message Henry Cate 2016-10-10 19:34:38 Re: BUG #14363: CASE against a literal value produces correct against, same expression against a column null doesn't