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

Re: Timestamp input + copy

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: "Kevin Bartz" <kbartz(at)loyaltymatrix(dot)com>,<pgsql-general(at)postgresql(dot)org>
Subject: Re: Timestamp input + copy
Date: 2004-07-28 23:15:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
On Wednesday 28 July 2004 3:11 pm, Kevin Bartz wrote:
> 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:

Edit the file to eliminate the PM. I don't know how large the file is 
but fixing the date should be pretty easy with vi, sed, perl, etc. 
(choose the one that works for you).

What seems like PostgreSQL being annoying and pedantic is really 
PostgreSQL protecting your a** - the importance of data integrity and 
all that.

Some databases try to be "helpful" (or are just sloppy) so if you try 
to insert a number bigger than that allowed by the field it just 
truncates it to the largest number that will fit. I hope nobody uses 
that database for financial data.

What should a database do if confronted with '2004-04-15 18:04:26 AM'? 
I would much prefer the system to throw an error and let me evaluate 
and fix it than silently "help" me by loading corrupt data.

Cheers and welcome to PostgreSQL,

In response to

pgsql-general by date

Next:From: Daniel VeriteDate: 2004-07-28 23:16:06
Subject: Re: [DEFAULT] Daily digest v1.4551 (20 messages)
Previous:From: Kevin BartzDate: 2004-07-28 23:06:56
Subject: Re: Timestamp input + copy

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