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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: hcate3(at)gmail(dot)com, "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:34:23
Message-ID: 11314.1476128063@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> 2016-10-10 20:56 GMT+02:00 <hcate3(at)gmail(dot)com>:
>> case decimal_9_1
>> when null then 0
>> when decimal_9_1 then 1 end),

> You cannot to compare NULL with NULL in Postgres.

More specifically, you can, but you get a NULL result. "NULL = NULL"
yields NULL, not true. This is per SQL standard.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next 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
Previous Message Pavel Stehule 2016-10-10 19:29:01 Re: BUG #14363: CASE against a literal value produces correct against, same expression against a column null doesn't