Re: Issue with to_timestamp function

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Lou Oquin <LOquin(at)nammotalley(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Issue with to_timestamp function
Date: 2014-09-09 01:04:25
Message-ID: 540E5219.5020303@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-09-09 03:58:08 Re: Crash in 9.4 Beta when partially collapsing left outer joins
Previous Message Adrian Klaver 2014-09-09 00:13:08 Re: Issue with to_timestamp function