Re: IN query operator and NULL values

From: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
To: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
Cc: Denis Gasparin <denis(at)edistar(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: IN query operator and NULL values
Date: 2008-05-16 16:58:24
Message-ID: 659A86E2-FF56-4173-81C3-6E71C69F56A5@solfertje.student.utwente.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On May 16, 2008, at 6:54 PM, Alban Hertroys wrote:

> development=> select b, coalesce( (b in (1, null))::text, 'NULL')
> from test;
> b | coalesce
> ---+----------
> 1 | true
> 2 | NULL
> | NULL
> (3 rows)

Just remembered a nice option from psql that doesn't quite clutter my
example as much:

development=> \pset null '<NULL>'
Null display is "<NULL>".
development=> select b, b in (1, null) from test;
b | ?column?
--------+----------
1 | t
2 | <NULL>
<NULL> | <NULL>
(3 rows)

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.

!DSPAM:737,482dbd32927664852116061!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andy Anderson 2008-05-16 17:00:48 Re: IN query operator and NULL values
Previous Message Alban Hertroys 2008-05-16 16:54:51 Re: IN query operator and NULL values