Re: Date data type - Mailing list pgsql-general

From Albe Laurenz
Subject Re: Date data type
Date
Msg-id D960CB61B694CF459DCFB4B0128514C202ACEFD8@exadv11.host.magwien.gv.at
Whole thread Raw
In response to Date data type  (Mike Hall <MHall@astc.nt.gov.au>)
List 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

pgsql-general by date:

Previous
From: Rainer Bauer
Date:
Subject: Re: Cannot remember what to do to get the information_schema, pg_catalog etc showing.
Next
From: Craig Ringer
Date:
Subject: Re: Date data type