Re: Null not equal to '' (empty)

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Null not equal to '' (empty)
Дата
Msg-id 200209271336.03193.dev@archonet.com
обсуждение исходный текст
Ответ на Null not equal to '' (empty)  (Ajit Aranha <ajit_aranha@rocketmail.com>)
Список pgsql-sql
On Friday 20 Sep 2002 7:09 am, Ajit Aranha wrote:
>  Why is ''(empty) not equal to null? Its a major headache when porting
> from other RDBMS like Oracle. Anyone knows any easy workarounds?

By definition it is different - null means "not known" or "no value" not empty
string. Do you think it should be zero for numbers?

> i.e. if you use:    create table tbl (
>                          c1 varchar(5));
>          insert into tbl values ('');
>                       select * from tbl where c1 is null;  will return
> zero rows.

Yep - that's the way it should be. If you want empty-strings, ask for them. If
you don't want to allow null values in a column define it as NOT NULL.

- Richard Huxton


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

Предыдущее
От: "Ries van Twisk"
Дата:
Сообщение: Re: Null not equal to '' (empty)
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Dublicates pairs in a table.