Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 585D32E1652 for ; Thu, 31 Jan 2008 14:00:27 -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 06106-06 for ; Thu, 31 Jan 2008 14:00:13 -0400 (AST) Received: from outbound2.ucsd.edu (outbound2.ucsd.edu [132.239.1.206]) by postgresql.org (Postfix) with ESMTP id 1FF932E0380 for ; Thu, 31 Jan 2008 14:00:12 -0400 (AST) Received: from smtp.ucsd.edu (smtp.ucsd.edu [132.239.1.49]) by outbound2.ucsd.edu (8.13.6/8.13.6) with ESMTP id m0VI0BeB036661 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 31 Jan 2008 10:00:11 -0800 (PST) DomainKey-Signature: a=rsa-sha1; s=2007001; d=ucsd.edu; c=simple; q=dns; b=jReIo5u3Xul2uvJymI9b1GrRrfDSDlphV9r2aJ9y1n+GYDxyiypu9fyJ7F3bHkQNe r3Bu9Bl4jWaY98QWOvNFw== Received: from [137.110.115.155] (dyn137-110-115-155.ucsd.edu [137.110.115.155]) (authenticated bits=0) by smtp.ucsd.edu (8.13.6/8.13.6) with ESMTP id m0VI0AVL008512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 31 Jan 2008 10:00:11 -0800 (PST) X-Authentication-Warning: smtp.ucsd.edu: Host dyn137-110-115-155.ucsd.edu [137.110.115.155] claimed to be [137.110.115.155] Message-ID: <47A20CAA.609@ucsd.edu> Date: Thu, 31 Jan 2008 10:00:10 -0800 From: Luca Clementi User-Agent: Thunderbird 2.0.0.6 (X11/20071022) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: Problem with the to_timestamp function References: <47A10A1D.5020408@ucsd.edu> <27257.1201739170@sss.pgh.pa.us> <47A12CCB.1000807@ucsd.edu> <751.1201759441@sss.pgh.pa.us> In-Reply-To: <751.1201759441@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/237 X-Sequence-Number: 30090 Tom Lane wrote: > 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? 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