Re: Null in the where-clause

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Null in the where-clause
Дата
Msg-id 20020708100433.S27784-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Null in the where-clause  (michael_walzl@yahoo.de (Michael Walzl))
Список pgsql-general
On 5 Jul 2002, Michael Walzl wrote:

> Hello everybody,
>
> I've got a problem with the "null"-statement within the where-clause.
> I installed the postgres-server 7.2.1 on a Suse Linux machine.
> Then I imported an existing databasedump.
> But when I make the following query:
> select * from tbl_categories where categoryid=null;
> I get 0 rows as result, but there are several records, which
> corrsponds to my query.

I doubt that ;)  categoryid=null never returns true, even when
categoryid is null itself (as per SQL spec).  You really want the
query:
select * from tbl_categories where categoryid IS null;

or, set TRANSFORM_NULL_EQUALS which turns =null into IS null,
but that's not recommended unless you can't change the queries
since that might break if someone expects =null to work properly.




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 7.2.1 optimises very badly against 7.2
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: Some Solaris notes, and an invitation