Re: case not sensitive to null condition ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: case not sensitive to null condition ?
Date: 2013-04-30 14:42:21
Message-ID: 3476.1367332941@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com> writes:
> thedb=# select
> ''''||bicolumn||'''',
> coalesce(permitted_values,'is_null'),
> case permitted_values when NULL then 'null' else ''''||permitted_values||'''' end
> from bi_constraints limit 2;

That's equivalent to "case when permitted_values = NULL then ..." which
doesn't work, because = never succeeds on nulls. You need to write
something like "case when permitted_values IS NULL then ...".

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Hastie 2013-04-30 15:28:07 zLinux Load Testing Experience
Previous Message Lutz Fischer 2013-04-30 14:20:53 Re: Windows query weird result