Re: Should we consider empty fields as NULL values when dealing with string columns ?

Поиск
Список
Период
Сортировка
От Shridhar Daithankar
Тема Re: Should we consider empty fields as NULL values when dealing with string columns ?
Дата
Msg-id 200312112030.15560.shridhar_daithankar@myrealbox.com
обсуждение исходный текст
Ответ на Should we consider empty fields as NULL values when dealing with string columns ?  ("Nagib Abi Fadel" <nagib.abi-fadel@usj.edu.lb>)
Список pgsql-general
On Thursday 11 December 2003 20:06, Nagib Abi Fadel wrote:
> HI,
> let's say we have the following table :
>
> # CREATE TABLE tempo (col1 varchar(3) not null);
> CREATE TABLE
>
> # insert INTO tempo VALUES ('');
> INSERT 11420541 1
>
> the insert command works.
>
> The issue is that since the column col1 is defined as character with not
> null attribute, shouldn't we deny such inserts (i mean inserting empty
> fields)???
> (PS: i am using postresql 7.3.2)

No. Because an empty string is not null.

If you want it to work the way  you describe, I believe you need to set
transform_null_equals to true in postgresql.conf

Check if  postgresql7.3.2 supports it. But remember, relying on this variable
is not recommended. Probably you should use indicator variables if php
supports it.

HTH

 Shridhar


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [NOVICE] PostgreSQL Training
Следующее
От: "Marc G. Fournier"
Дата:
Сообщение: Re: [NOVICE] PostgreSQL Training