Re: weird results from trivial SELECT statement

Поиск
Список
Период
Сортировка
От Lonni J Friedman
Тема Re: weird results from trivial SELECT statement
Дата
Msg-id BANLkTikAtfnOksfwb2g-xtONcnFZhqroog@mail.gmail.com
обсуждение исходный текст
Ответ на Re: weird results from trivial SELECT statement  ("Oliveiros d'Azevedo Cristina" <oliveiros.cristina@marktest.pt>)
Ответы Re: weird results from trivial SELECT statement  (Lew <noone@lewscanon.com>)
Список pgsql-novice
Thanks for the reply.  This corresponds with the behavior that I'm seeing.

On Wed, Apr 27, 2011 at 9:47 AM, Oliveiros d'Azevedo Cristina
<oliveiros.cristina@marktest.pt> wrote:
> From my knowledge, I think that NULL is not a value, it's rather the absense
> of a value.
> It doesn't matter if you use = or !=,  testing 'disabled' against a NULL
> column will always fail.
>
> Why dont you try a WHERE clause like
> WHERE active != 'disabled
> OR active IS NULL
> if you want the NULL records as well.
>
> HTH,
>
>
> Best,
> Oliveiros
>
>
> ----- Original Message ----- From: "Lonni J Friedman" <netllama@gmail.com>
> To: <pgsql-novice@postgresql.org>
> Sent: Wednesday, April 27, 2011 5:25 PM
> Subject: [NOVICE] weird results from trivial SELECT statement
>
>
>> Greetings,
>> I've got a Postgresql-8.4.x instance with a bunch of tables taht have
>> a text column (called 'active') that can contain any one of the
>> following values:
>> NULL
>> 'disabled'
>> <some other text string>
>>
>> When I run the following query, it seems to ignore NULL values:
>> SELECT * FROM mytbl WHERE active!='disabled'
>>
>> and only returns rows where active!='disabled' AND active IS NOT NULL.
>> Is postgresql implicitly assuming that I want non-NULL values?
>>
>> I can provide additional information, if requested.
>>
>> thanks!

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Oliveiros d'Azevedo Cristina"
Дата:
Сообщение: Re: weird results from trivial SELECT statement
Следующее
От: Brent Dombrowski
Дата:
Сообщение: Re: weird results from trivial SELECT statement