Re: SELECT CAST(123 AS char) -> 1

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Ken Johanson <pg-user(at)kensystem(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SELECT CAST(123 AS char) -> 1
Date: 2008-02-12 07:58:32
Message-ID: 20080212075832.GB18543@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2008-02-12 08:19:01 Re: WINDOWS INSTALLATION TIPS
Previous Message Ken Johanson 2008-02-12 07:49:26 Re: SELECT CAST(123 AS char) -> 1