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

From: Ken Johanson <pg-user(at)kensystem(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: SELECT CAST(123 AS char) -> 1
Date: 2008-02-13 00:48:37
Message-ID: 47B23E65.4070600@kensystem.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
>
>> Simply that a commonly used database (my) does not support it.
>
> They do support char(n) in this context, which would have the advantage
> of being standards compliant as well as de-facto portable.
>

Hmm, interesting. Mysql actual returns:
select cast(123 AS char(10)) -> '123' (agreed wrong since length is
explicit)

And PG (Ms also) gives:
select cast(123 AS char(10)) -> '123 ' (tested via jdbc driver since
hard to visualize the space in psql)

and PG:
select '='||cast(123 AS char(10))||'=' -> '=123=' (test via psql)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dean Gibson (DB Administrator) 2008-02-13 02:53:58 Re: SELECT CAST(123 AS char) -> 1
Previous Message Tom Lane 2008-02-13 00:30:53 Re: SELECT CAST(123 AS char) -> 1