NULL value comparison

Поиск
Список
Период
Сортировка
От Michael Sacket
Тема NULL value comparison
Дата
Msg-id 9042C0C5-1A9E-420E-B143-7896FB9440A1@gammastream.com
обсуждение исходный текст
Ответы Re: NULL value comparison  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: NULL value comparison  (Adrian Klaver <adrian.klaver@gmail.com>)
Re: NULL value comparison  (David Johnston <polobo@yahoo.com>)
Список pgsql-general
Good Day,

I'm trying to figure out why a postgresql query doesn't return what I'd expect with a query like this where there are
NULLvalues: 

select * from users where is_enabled<>'Y';

I'm expecting it to return all records where is_enabled is 'N' or NULL.  Perhaps my expectations are misguided.  Any
thoughtswould be appreciated. 

Thanks!
Michael


Example:

CREATE TABLE users (
    "name" char(50) NOT NULL,
    "is_enabled" char
)

insert into users (name, is_enabled) values ('Michael', 'Y');
insert into users (name, is_enabled) values ('Jeremy', 'N');
insert into users (name, is_enabled) values ('Sherry', NULL);


select * from users where is_enabled<>'Y';
+----------------------------------------------------+------------+
| name                                               | is_enabled |
+----------------------------------------------------+------------+
| Jeremy                                             | N          |
+----------------------------------------------------+------------+
1 rows in set (0.03 sec)





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

Предыдущее
От: Chris Travers
Дата:
Сообщение: Re: Are there any options to parallelize queries?
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: NULL value comparison