Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 244D42E008E for ; Thu, 31 Jan 2008 02:04:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 61958-07 for ; Thu, 31 Jan 2008 02:04:02 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 11C5B2E00A4 for ; Thu, 31 Jan 2008 02:04:01 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m0V641a0000752; Thu, 31 Jan 2008 01:04:01 -0500 (EST) To: Luca Clementi cc: pgsql-sql@postgresql.org Subject: Re: Problem with the to_timestamp function In-reply-to: <47A12CCB.1000807@ucsd.edu> References: <47A10A1D.5020408@ucsd.edu> <27257.1201739170@sss.pgh.pa.us> <47A12CCB.1000807@ucsd.edu> Comments: In-reply-to Luca Clementi message dated "Wed, 30 Jan 2008 18:04:59 -0800" Date: Thu, 31 Jan 2008 01:04:01 -0500 Message-ID: <751.1201759441@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/236 X-Sequence-Number: 30089 Luca Clementi 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? regards, tom lane