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