Re: entering empty value

Поиск
Список
Период
Сортировка
От Gregory Wood
Тема Re: entering empty value
Дата
Msg-id 003601c1ba9b$8ca58700$7889ffcc@comstock.com
обсуждение исходный текст
Ответ на Re: entering empty value  (missive@frontiernet.net (Lee Harr))
Ответы Re: entering empty value
Список pgsql-general
> > I have a table with records where sometimes a value should be kept empty
> > e.g. faxnumber is sometime empty because not everybody owns a fax. What
> > is the syntax for entering the data for such a record with  an empty
> > value?
>
> create table t (a int, b text);
>
> insert into t values(1, NULL)

Actually, to be anal, a NULL value is used to denote an undefined or unknown
value. If the value is known to be empty (and assuming this is stored in a
string field such as TEXT or VARCHAR), it might be more appropriate to say:

insert into t values (1,'');

This is especially true as empty strings can be used in an index, while NULL
values, to the best of my knowledge, do not appear in indexes.

Greg


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

Предыдущее
От: virka prasetia
Дата:
Сообщение: OID
Следующее
От: Tom Lane
Дата:
Сообщение: Re: entering empty value