Re: Timestamp input + copy
От | Steve Crawford |
---|---|
Тема | Re: Timestamp input + copy |
Дата | |
Msg-id | 200407281615.42212.scrawford@pinpointresearch.com обсуждение исходный текст |
Ответ на | Timestamp input + copy ("Kevin Bartz" <kbartz@loyaltymatrix.com>) |
Список | 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, Steve
В списке pgsql-general по дате отправления: