Re: [SQL] Problem with the to_timestamp function

2008-01-30 Thread Tom Lane
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 strin

Re: [SQL] Problem with the to_timestamp function

2008-01-30 Thread Luca Clementi
Tom Lane wrote: Luca Clementi <[EMAIL PROTECTED]> writes: It seems that the to_timestamp does not work properly in this case, when it comes to parsing the hours. to_timestamp() is not very robust if the input doesn't exactly match what it expects for the format string. I'm not sure if that's

Re: [SQL] Problem with the to_timestamp function

2008-01-30 Thread Michael Glaesemann
On Jan 30, 2008, at 19:26 , Tom Lane wrote: (BTW, there is definitely 0 hope of recognizing a timezone name that's written in Chinese characters, unless maybe you fool around with the timezone-abbreviations configuration file.) Just FYI, the characters in the original email are the equivalent

Re: [SQL] Problem with the to_timestamp function

2008-01-30 Thread Tom Lane
Luca Clementi <[EMAIL PROTECTED]> writes: > It seems that the to_timestamp does not work properly in this case, > when it comes to parsing the hours. to_timestamp() is not very robust if the input doesn't exactly match what it expects for the format string. I'm not sure if that's the issue here,

[SQL] Problem with the to_timestamp function

2008-01-30 Thread Luca Clementi
So the start_time is a varchar column, which contains a date. opal_app=# select job_id,start_time from job_status where job_id='app1201551799779' ; job_id |start_time --+-- app1201551799779 | 1 28, 2008 12:23:19 午後 (1 row) o

Re: [SQL] Sql ORDER BY and ASC/DESC question

2008-01-30 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > Gregory Stark <[EMAIL PROTECTED]> writes: > >> ORDER BY >> CASE ? >> WHEN 1 THEN name ASC > > Uh, no, putting the ASC/DESC decoration inside a CASE like that is not > gonna work doh! I had a feeling something was wrong but couldn't put my finger on it

Re: [SQL] Sql ORDER BY and ASC/DESC question

2008-01-30 Thread Tom Lane
Gregory Stark <[EMAIL PROTECTED]> writes: > If you're not concerned with the planner being able to find indexes to satisfy > these orderings (ie, you don't mind always doing a sort) you could do > something like: > ORDER BY > CASE ? > WHEN 1 THEN name ASC > WHEN 2 THEN name DESC > WHEN 3 THE

Re: [SQL] Sql ORDER BY and ASC/DESC question

2008-01-30 Thread Gregory Stark
"A. Kretschmer" <[EMAIL PROTECTED]> writes: > am Wed, dem 30.01.2008, um 11:35:51 +0100 mailte Jaroslav Sivy folgendes: >> Hello everyone, >> >> I have following problem: am using pl/sql functions to trigger some >> sql code and i need to pass ORDER_BY column name and ASC/DESC sorting >> order a

Re: [SQL] Sql ORDER BY and ASC/DESC question

2008-01-30 Thread Bart Degryse
Actually there might be assuming your function is a set returning function. This example eg works perfectly and sorts the output of the function without having to use execute. CREATE TABLE "public"."error_types" ( "id" SERIAL, "errdesc" TEXT NOT NULL, "autofix" BOOLEAN DEFAULT false NOT

Re: [SQL] Sql ORDER BY and ASC/DESC question

2008-01-30 Thread A. Kretschmer
am Wed, dem 30.01.2008, um 11:35:51 +0100 mailte Jaroslav Sivy folgendes: > Hello everyone, > > I have following problem: am using pl/sql functions to trigger some > sql code and i need to pass ORDER_BY column name and ASC/DESC sorting > order as an input parameters into that function and order t

[SQL] Sql ORDER BY and ASC/DESC question

2008-01-30 Thread Jaroslav Sivy
Hello everyone, I have following problem: am using pl/sql functions to trigger some sql code and i need to pass ORDER_BY column name and ASC/DESC sorting order as an input parameters into that function and order the result based on these input parameters. The problem is, that the only way is to