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

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)
 
When using script languages (like PHP) if by mistake the variable is not defined such insert is possible (let's say we have a variable $col1_value and after a long day of work we make a mistake and write it $col_value).
 
This "problem" is solved by adding the constraint:
 ALTER TABLE tempo add constraint col1_check check(col1!='');
 

pgsql-hackers by date:

Previous
From: Doug McNaught
Date:
Subject: Re: PostgreSQL port to pure Java?
Next
From: "Dave Page"
Date:
Subject: Re: Should we consider empty fields as NULL values when dealing with string columns ?