| From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
|---|---|
| To: | Kirk Wythers <kirk(dot)wythers(at)gmail(dot)com> |
| Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: data type - import problem |
| Date: | 2012-12-17 22:05:20 |
| Message-ID: | 50CF9720.5050508@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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(dot)klaver(at)gmail(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thomas Kellerer | 2012-12-17 22:14:08 | Re: XML Schema for PostgreSQL database |
| Previous Message | Guillaume Lelarge | 2012-12-17 22:03:06 | Re: XML Schema for PostgreSQL database |