Re: data type troubles

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: data type troubles
Дата
Msg-id CAOR=d=2_DyOsFg-8puEA8Ribv7i2-M6Z1xWpxfqPQ0WNB5cBxg@mail.gmail.com
обсуждение исходный текст
Ответ на data type troubles  (Kirk Wythers <wythe001@umn.edu>)
Список pgsql-general
On Mon, Dec 17, 2012 at 2:38 PM, Kirk Wythers <wythe001@umn.edu> wrote:
>
> I seem to be dealing with a data type issue when I try and import data
> into a new and empty database.
>
> Error Message: ERROR:  date/time field value out of range:
> "1332471600:00:00"
> LINE 1: ...tc_avg25") values ('2012-03-22 21:00:00_B4WARM_A','133247160…
>
> Here are the first two rows in the files I was sent. I cast ROWID as
> varchar32, TIME2 as time (I was told that TIME2 was a posix time value), and
> TIMESTAMP as timestamp.
>
> Any advice that would help me out of this hole is appreciated.

Giant lines deleted.  OK, it looks like the 1332471600 is a unix
timestamp, not a SQL timestamp.

First thing I'd do is make a staging table to hold all these rows.
Declare that second field as bigint and so on, so you can load all
your rows at once.

After all the rows are loaded into a staging table, then you can start
using various pg functions to convert from unix timestamp to sql
timestamp etc.

http://www.postgresql.org/docs/8.4/static/functions-datetime.html

Search for the keyword "epoch" on that page for how to convert back
and forth from unix timestamps.


В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: server registration problems
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: Implicit transaction not rolling back after error