Re: Date data type

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Mike Hall *EXTERN*" <MHall(at)astc(dot)nt(dot)gov(dot)au>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Date data type
Date: 2008-11-03 08:38:44
Message-ID: D960CB61B694CF459DCFB4B0128514C202ACEFD8@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mike Hall wrote:
> I'm currently converting an MS Access database to PostgreSQL
> (version 8.1 as it is the vesion that ships with CentOS 5).
>
> I'm having trouble with an INSERT statement attempting to
> insert an empty value ('') into a field with data type DATE.
> This produces the following error message:
>
> ERROR: invalid input syntax for type date: ""
>
> It does the same whether the field has a NOT NULL restraint or not.
>
> I can't find anything relevant in the documentation.
>
> What am I doing wrong.

An empty string is not a NULL value.
An empty string cannot be converted to a valid date.

Use NULL instead of '' to insert a NULL value.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2008-11-03 08:59:07 Re: Date data type
Previous Message Rainer Bauer 2008-11-03 08:17:13 Re: Cannot remember what to do to get the information_schema, pg_catalog etc showing.