X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 35061D1B439 for ; Wed, 26 Nov 2003 07:06:08 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 99874-10 for ; Wed, 26 Nov 2003 03:05:38 -0400 (AST) Received: from smtp013.mail.yahoo.com (smtp013.mail.yahoo.com [216.136.173.57]) by svr1.postgresql.org (Postfix) with SMTP id 43A8CD1B44E for ; Wed, 26 Nov 2003 03:05:36 -0400 (AST) Received: from ptil-138-190-chn.primus-india.net (HELO IVESIA67) (sgnerd@203.196.190.138 with login) by smtp-v1.mail.vip.sc5.yahoo.com with SMTP; 26 Nov 2003 07:05:36 -0000 Message-ID: <00e301c3b3eb$5c26f7d0$7502a8c0@hdsc.com> Reply-To: "Kumar" From: "Kumar" To: "Richard Huxton" , "psql" References: <037f01c3b350$fa38ae00$7502a8c0@hdsc.com> <200311251614.16957.dev@archonet.com> Subject: Re: ::text problem Date: Wed, 26 Nov 2003 12:33:04 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.6 tagged_above=0.0 required=5.0 tests=QUOTED_EMAIL_TEXT, REFERENCES, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200311/286 X-Sequence-Number: 16101 Thanks a lot. It worked. ----- Original Message ----- From: "Richard Huxton" To: "Kumar" ; "psql" Sent: Tuesday, November 25, 2003 9:44 PM Subject: Re: [SQL] ::text problem > On Tuesday 25 November 2003 12:37, Kumar wrote: > > > > SELECT > > CASE WHEN c1 IS NULL THEN 'Record_Not_Found'ELSE c1 END as > > approval_date FROM t1; > > ERROR: Bad timestamp external representation 'Record_Not_Found' > > > > > > SELECT > > CASE WHEN c1 IS NULL THEN 'Record_Not_Found'::text ELSE c1 END as > > approval_date FROM t1; > > ERROR: CASE types 'timestamp without time zone' and 'text' not matched > > Almost - you're on the right lines. Try: > SELECT > CASE > WHEN c1 IS NULL THEN 'Record_Not_Found'::text > ELSE c1::text > END as approval_date FROM t1; > > You need to make sure both options return type text. > > -- > Richard Huxton > Archonet Ltd