Thread: date default

date default

From
Robert Morgan
Date:
I'm updating a table that has a field which is datatype 'date' this
field maybe filled out or not before update. If the field  is left blank
I get an error, if I test to see if the field is empty and if it is, set
the value to 0001/01/01 then postgres will accept this. I would rather
the field remained empty but setting the field to 'null' is not accepted
by postgres. Im using php to test and set the value.

Bob



Re: date default

From
Oliver Elphick
Date:
On Thu, 2004-05-27 at 05:30, Robert Morgan wrote:
> I'm updating a table that has a field which is datatype 'date' this
> field maybe filled out or not before update. If the field  is left blank
> I get an error, if I test to see if the field is empty and if it is, set
> the value to 0001/01/01 then postgres will accept this. I would rather
> the field remained empty but setting the field to 'null' is not accepted
> by postgres. Im using php to test and set the value.

An empty string is not the same as null; what command is PHP sending to
the backend?

If the date column is mentioned, the value inserted for it must be NULL,
not ''.  If that is already the case, make sure the column has not been
declared with a NOT NULL constraint.

Oliver Elphick