Re: SELECT CAST(123 AS char) -> 1 - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: SELECT CAST(123 AS char) -> 1
Date
Msg-id 20080212075832.GB18543@svana.org
Whole thread Raw
In response to SELECT CAST(123 AS char) -> 1  (Ken Johanson <pg-user@kensystem.com>)
List pgsql-general
On Mon, Feb 11, 2008 at 10:36:49PM -0700, Ken Johanson wrote:
> For sake of interoperability (and using an API that requires String-type
> hashtable keys), I'm trying to find a single CAST (int -> var/char)
> syntax that works between the most databases. Only char seems to be a
> candidate, but in 8.3 casting from an integer outputs only the first char...

Does it have to be a cast? I would've thought to_char() might work more
reliably across databases.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
>  -- John F Kennedy

Attachment

pgsql-general by date:

Previous
From: Ken Johanson
Date:
Subject: Re: SELECT CAST(123 AS char) -> 1
Next
From: Richard Huxton
Date:
Subject: Re: WINDOWS INSTALLATION TIPS