Re: Date data type

From: Klint Gore <kgore4(at)une(dot)edu(dot)au>
To: Mike Hall <MHall(at)astc(dot)nt(dot)gov(dot)au>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Date data type
Date: 2008-11-03 07:31:35
Message-ID: 490EA8D7.7090906@une.edu.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mike Hall wrote:
> Gday,
>
> 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.
>

You're trying to put the empty string into a date field
insert into atable (date_col) values (''); -- syntax error
insert into atable (date_col) values (null); -- works

klint.

--
Klint Gore
Database Manager
Sheep CRC
A.G.B.U.
University of New England
Armidale NSW 2350

Ph: 02 6773 3789
Fax: 02 6773 3266
EMail: kgore4(at)une(dot)edu(dot)au

In response to

Browse pgsql-general by date

  From Date Subject
Next Message wstrzalka 2008-11-03 07:35:59 Re: psql screen size
Previous Message Mike Hall 2008-11-03 06:33:33 Date data type