From: Richard Huxton <dev@archonet.com>
To: Kumar <sgnerd@yahoo.com.sg>
To: psql <pgsql-sql@postgresql.org>
Subject: Re: ::text problem
Date: Tue, 25 Nov 2003 16:14:16 +0000
Message-ID: <200311251614.16957.dev@archonet.com> (raw)
In-Reply-To: <037f01c3b350$fa38ae00$7502a8c0@hdsc.com>
References: <037f01c3b350$fa38ae00$7502a8c0@hdsc.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, sgnerd@yahoo.com.sg
Subject: Re: ::text problem
In-Reply-To: <200311251614.16957.dev@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox