Re: [SQL] Problem with the to_timestamp function

2008-01-31 Thread Tom Lane
Luca Clementi <[EMAIL PROTECTED]> writes:
> 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.

Locale has nothing to do with this --- at most you might want to adjust
the datestyle parameter.

regards, tom lane

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [SQL] Problem with the to_timestamp function

2008-01-31 Thread Luca Clementi

Tom Lane wrote:

Luca Clementi <[EMAIL PROTECTED]> writes:

I found the problem!!
to_timestamp(start_time, 'M DD,   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,  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

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster