Timestamp input + copy - Mailing list pgsql-general

From Kevin Bartz
Subject Timestamp input + copy
Date
Msg-id 20040728221644.A42F23FE8B@omta16.mta.everyone.net
Whole thread Raw
Responses Re: Timestamp input + copy
List pgsql-general
Hi Postgressers! I really like Postgres. Thanks for all your work on it. I
just have a problem with the way it's handling my flat file's timestamp
columns.

I have a flat file with a column with dates formatted like this:

2004-04-15 18:04:26 PM

It's a bit strange, I know, but I didn't create the file. My idea of
Postgres's proper behavior would be to load this date as a military time
(and ignore the "PM"). MS SQL Server behaves in this way. Postgres, however,
won't even load the file:

bonusticket=copy bonusticket2004Q2 from
'/home/kevin/bonusticket/data3/uberfile/uberfile1.txt' null as '';
# ERROR:  date/time field value out of range: "2004-04-15 18:04:26 PM"
CONTEXT:  COPY bonusticket2004q2, line 17, column submit_date: "2004-04-15
18:04:26 PM"

I presume that Postgres is complaining about the fact that I have an 18 in
the hour slot of a supposedly PM time. What can I do about this? Can I
possibly specify a time format (similar to the 'YYYY-MM-DD HH24:MI:SS' I
might pass to to_timestamp) at load time?

Thanks for any help you can provide,

Kevin


pgsql-general by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: php -postgresql
Next
From: "Chris Smith"
Date:
Subject: Re: Timestamp input + copy