Re: Issue with to_timestamp function - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Issue with to_timestamp function
Date
Msg-id 540E5219.5020303@aklaver.com
Whole thread Raw
In response to Issue with to_timestamp function  (Lou Oquin <LOquin@nammotalley.com>)
Responses Re: Issue with to_timestamp function  (Lou Oquin <LOquin@nammotalley.com>)
List pgsql-general
On 09/08/2014 01:52 PM, Lou Oquin wrote:
> I’ve imported a csv export of an MS SQL Server log file into a staging
> table on my local install of Postgresql (9.3/UTF8 encoding) for analysis.
>

>
> select to_timestamp(ts, 'MM/DD/YYYY hh24:mi:ss')::timestamp with time
> zone as tStamp
>
> from sql_log_import
>
> where id <= 10
>
> ********** Error **********
>
> SQL state: 22007
>
> Detail: Value must be an integer.
>
> Any Ideas?

To get that error I had to do something like this:

hplc=> select to_timestamp('aug/06/2014 03:08:58 ', 'MM/DD/YYYY
hh24:mi:ss');
ERROR:  invalid value "au" for "MM"
DETAIL:  Value must be an integer.

So at a guess, the data being imported has some month abbreviations in it.

>
> Thanks
>
> *Lou O’Quin*
>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Issue with to_timestamp function
Next
From: Tom Lane
Date:
Subject: Re: Crash in 9.4 Beta when partially collapsing left outer joins