dbTalk Databases Forums  

date default

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss date default in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Robert Morgan
 
Posts: n/a

Default date default - 05-26-2004 , 11:30 PM






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



---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Reply With Quote
  #2  
Old   
Oliver Elphick
 
Posts: n/a

Default Re: date default - 05-27-2004 , 05:02 AM






On Thu, 2004-05-27 at 05:30, Robert Morgan wrote:
Quote:
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


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.