Re: data type - import problem

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: data type - import problem
Дата
Msg-id 50CF9720.5050508@gmail.com
обсуждение исходный текст
Ответ на data type - import problem  (Kirk Wythers <kirk.wythers@gmail.com>)
Ответы Re: data type - import problem
Список pgsql-general
On 12/17/2012 01:53 PM, Kirk Wythers 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.

Assuming by POSIX time you mean seconds since epoch you will need to do
something like this:

test=# SELECT to_timestamp(1332471600);
       to_timestamp
------------------------
  2012-03-22 20:00:00-07

For time:
test=# SELECT to_timestamp('1332471600')::time;
  to_timestamp
--------------
  20:00:00


In your INSERT statement use the to_timestamp() in the VALUES portion.
--
Adrian Klaver
adrian.klaver@gmail.com


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

Предыдущее
От: Guillaume Lelarge
Дата:
Сообщение: Re: XML Schema for PostgreSQL database
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: XML Schema for PostgreSQL database