Re: [SQL] '' != NULL in PostGres???

Поиск
Список
Период
Сортировка
От Brook Milligan
Тема Re: [SQL] '' != NULL in PostGres???
Дата
Msg-id 199809231810.MAA18985@trillium.nmsu.edu
обсуждение исходный текст
Ответ на '' != NULL in PostGres???  (Neil Harkins <nharkins@well.com>)
Ответы Re: [SQL] '' != NULL in PostGres???  (Colin Dick <cdick@mail.ocis.net>)
Список pgsql-sql
   nuacct=> create table users (
   nuacct->  recno int,
   nuacct->  custid int unique,
   nuacct->  username char(14) not null,
   nuacct->  service int
   nuacct-> );

   nuacct=> insert into users values
   nuacct-> ( 0, 0, '', 0 );
   INSERT 18241 1

   ??? Shouldn't that have failed, generating an error ???

No, but this will:

   nuacct=> insert into users values ( 0, 0, null, 0 );

'' is a zero length string not a null.

Cheers,
Brook

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

Предыдущее
От: Neil Harkins
Дата:
Сообщение: '' != NULL in PostGres???
Следующее
От: David Hartwig
Дата:
Сообщение: Re: [SQL] case-insensitive SORT BY?