X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9858753E16 for ; Fri, 22 Apr 2005 06:09:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60768-01 for ; Fri, 22 Apr 2005 09:09:09 +0000 (GMT) Received: from ausimss.pervasive.com (ausimss.pervasive.com [66.45.103.246]) by svr1.postgresql.org (Postfix) with ESMTP id 2601153E02 for ; Fri, 22 Apr 2005 06:08:57 -0300 (ADT) Received: from ausbayes1.aus.pervasive.com ([172.16.8.6]) by ausimss.pervasive.com with InterScan Messaging Security Suite; Fri, 22 Apr 2005 04:08:52 -0500 Received: from ausmail2k3.aus.pervasive.com ([172.16.4.8]) by ausbayes1.aus.pervasive.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 22 Apr 2005 04:08:51 -0500 Received: from BLRMAIL1.aus.pervasive.com ([10.3.16.60]) by ausmail2k3.aus.pervasive.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 22 Apr 2005 04:04:54 -0500 content-class: urn:content-classes:message Subject: Re: string to date conversion MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Fri, 22 Apr 2005 14:38:43 +0530 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Message-ID: <02767D4600E59A4487233B23AEF5C5992A407D@blrmail1.aus.pervasive.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] string to date conversion Thread-Index: AcVHF7McIu3B2yPsReKb4iEdSZI33gAAqCiQ From: "Ramakrishnan Muralidharan" To: "Jerome Alet" , X-OriginalArrivalTime: 22 Apr 2005 09:04:54.0327 (UTC) FILETIME=[59532470:01C5471A] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.137 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/341 X-Sequence-Number: 21234 Hi, I have tried the same in PostgreSQL 8.0.1 and it is working fine. I = have used following example for testing create table test1 ( date varchar(10) ) insert into test1 values('2005/04/22') select date::timestamp from test1 Regards, R.Muralidharan =20 -----Original Message----- From: Jerome Alet [mailto:alet@librelogiciel.com] Sent: Friday, April 22, 2005 2:13 PM To: pgsql-sql@postgresql.org Subject: [SQL] string to date conversion Hi, I'm working on an existing Pg database which, please don't ask why, stores dates as varchar attributes in the form 'YYYY/MM/DD' I'm not allowed to modify the tables to use 'timestamp' instead, so I'd like to convert on the fly when retrieving datas with select. When I do : select mydatefield::timestamp from mytable; =20 There's an error saying that converting from varchar to date is =20 not possible How can I do this ? Thanks in advance Jerome Alet ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org