Re: Should we consider empty fields as NULL values when dealing with string columns ? - Mailing list pgsql-general

From Shridhar Daithankar
Subject Re: Should we consider empty fields as NULL values when dealing with string columns ?
Date
Msg-id 200312112030.15560.shridhar_daithankar@myrealbox.com
Whole thread Raw
In response to Should we consider empty fields as NULL values when dealing with string columns ?  ("Nagib Abi Fadel" <nagib.abi-fadel@usj.edu.lb>)
List 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 by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [NOVICE] PostgreSQL Training
Next
From: "Marc G. Fournier"
Date:
Subject: Re: [NOVICE] PostgreSQL Training