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!='');
|
- Re: [HACKERS] [GENERAL] Should we consider empty fields as... Nagib Abi Fadel
- Re: [HACKERS] [GENERAL] Should we consider empty fiel... Doug McNaught
- Re: [HACKERS] [GENERAL] Should we consider empty fiel... Chris Travers
- Re: [HACKERS] [GENERAL] Should we consider empty fiel... Richard Huxton
- Re: [HACKERS] Should we consider empty fields as NULL... Dave Page