Re: Inserting a Null date.

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Rob Mosher <mosher(at)andrews(dot)edu>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Inserting a Null date.
Date: 2004-02-02 21:22:21
Message-ID: 200402021322.21879.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Rob,

> I am trying to add entries to my database via a Perl script, where some
> fields are optional, that is, nulls are allowed. When inserting an
> entry, I include every field in the insert statement, but leave their
> value undefined if it is optional and left blank. This works for every
> field but date fields. Setting a date field to undefined generates the
> error "Bad date external representation". Is there a way to leave a date
> field null while still having it as an argument in an insert (i.e. INSET
> INTO table (id, mydate) VALUES (1, NULL) ), or will I need to make
> several different insertion statements for each different case?

Inserting a null should work fine. Are you sure Perl isn't passing an empty
string ( '' ) instead?

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Christian Armeanu 2004-02-02 21:30:31 Re: Postgresql And Redhat Enterprise 3
Previous Message Joe Conway 2004-02-02 18:58:15 Re: Encrypting and compiling