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

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
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-16 21:17:51
Message-ID: 20080216131229.F99263@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Sat, 16 Feb 2008, Ken Johanson wrote:

> Tom Lane wrote:
>
> > Hm, good point, so really we ought to have a separate casting path for
> > numeric types to char(n). However, this section still doesn't offer
> > any support for the OP's desire to auto-size the result; it says
> > that you get an error if the result doesn't fit in the declared
> > length:
> >
> >> iv) Otherwise, an exception condition is raised: data exception-
> >> string data, right truncation.
> >
>
> I don't believe the size is being declared in the OP's (subject line)
> example: SELECT CAST(123 AS char)

The other part of Tom's quotes still apply:
If length is omitted then a length of 1 is implicit.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2008-02-16 23:19:35 Re: Pains in upgrading to 8.3
Previous Message Bruce Momjian 2008-02-16 21:12:18 Re: [GENERAL] PG quitting sporadically!!