Re: IN clause

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in, pgsql-general(at)postgresql(dot)org
Subject: Re: IN clause
Date: 2006-11-24 18:10:15
Message-ID: 607140.3262.qm@web31813.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> That is fine
> but what I was actually expecting is this
> if
> select * from table where col_name in (null, 'a', 'b');
>
> to return those rows where col_name is null or if it = a or if it is = b
>
> But i think in does not not support null queries , am i right?
>

that is correct: if col_name was actually 'a' then you would get:

'a' in ( null, 'a', 'b', ...) works the same as:

'a' = null ~ resolves to Unknown
or
'a' = 'a' ~ resovles to true
or
'a' = 'b' ~ resovles to false
or
...

so you end up with:
(unknown or true or false) = true
but if you have
(unknown or false or false) = false

Regards,

Richard Broersma Jr.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ben 2006-11-24 18:38:00 Re: indexes
Previous Message Joshua D. Drake 2006-11-24 16:21:22 Re: indexes