Обсуждение: Empty Date Field
Hi, could any one tell me how can I tell postgres that a date field I made in a table can be empty. I created a table with a field like that but I didn't tell it "not null" in the declaration, and when I try to fill this table with an empty date it gives me an error. Thank you. Fabian. ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
"fabian baena" wrote: >Hi, could any one tell me how can I tell postgres that a date field I made >in a table can be empty. > >I created a table with a field like that but I didn't tell it "not null" in >the declaration, and when I try to fill this table with an empty date it >gives me an error. If you don't mention the field in an update or insert, it will automatically be null. You can't fill it with the empty string. You can specifically make it null: insert into tablex (dtfield) values (null); -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver PGP key from public servers; key ID 32B8FAA1 ======================================== "Therefore, my beloved brethren, be ye stedfast, unmoveable, always abounding in the work of the Lord, forasmuch as ye know that your labor is not in vain in the Lord." I Corinthians 15:58
Set the field to null. i.e. update foo set datetime=null where... fabian baena wrote: > > Hi, could any one tell me how can I tell postgres that a date field I made > in a table can be empty. > > I created a table with a field like that but I didn't tell it "not null" in > the declaration, and when I try to fill this table with an empty date it > gives me an error. > > Thank you. > > Fabian. > > ______________________________________________________ > Get Your Private, Free Email at http://www.hotmail.com