Search Postgresql Archives

Re: data type - import problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux