From: Luca Clementi <lclement@ucsd.edu>
To: pgsql-sql@postgresql.org
Subject: Re: Problem with the to_timestamp function
Date: Thu, 31 Jan 2008 10:00:10 -0800
Message-ID: <47A20CAA.609@ucsd.edu> (raw)
In-Reply-To: <751.1201759441@sss.pgh.pa.us>
References: <47A10A1D.5020408@ucsd.edu>
<27257.1201739170@sss.pgh.pa.us>
<47A12CCB.1000807@ucsd.edu>
<751.1201759441@sss.pgh.pa.us>
Tom Lane wrote:
> Luca Clementi <lclement@ucsd.edu> writes:
>> I found the problem!!
>> to_timestamp(start_time, 'M DD, YYYY HH12:MI:SS')
>> in the formatting string I have two spaces, while in the original there
>> is only one:
>> 1 28, 2008 12:23:19 åˆå¾Œ
>> So if I use: 'M DD, YYYY HH12:MI:SS' as a formatting string it works!
>> I wander how come if the formatting string doesn't match properly you
>> get such a bad behavior, would it better just a error?
>
> Yeah, it should either do something reasonable or throw an error.
> Improving to_timestamp's handling of such cases is on the TODO list.
> In the meantime, though, the standard input converter is a whole lot
> more flexible for slightly-out-of-spec input ... so I ask again,
> do you really need to_timestamp at all?
What do you mean with th standard input converter, you mean casting that
string into a date with the default locate format. This won't work,
because the machine where the DB is running is set to en.US, so it won't
be able to parse that date. That's why I am using the to_timestamp.
I am doning some data clean up in my DB.
Thanks again for your help,
Luca
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: lclement@ucsd.edu
Subject: Re: Problem with the to_timestamp function
In-Reply-To: <47A20CAA.609@ucsd.edu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox