Skip site navigation (1) Skip section navigation (2)

Inserting a Null date.

From: Rob Mosher <mosher(at)andrews(dot)edu>
To: pgsql-novice(at)postgresql(dot)org
Subject: Inserting a Null date.
Date: 2004-02-02 16:21:55
Message-ID: 401E7923.3090505@andrews.edu (view raw or flat)
Thread:
Lists: pgsql-novice
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?

Thank you,
Rob Mosher

Responses

pgsql-novice by date

Next:From: Joe ConwayDate: 2004-02-02 18:58:15
Subject: Re: Encrypting and compiling
Previous:From: Russell ShawDate: 2004-02-02 15:46:41
Subject: Joins

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group