Re: Why length(to_char(1::integer, '9')) = 2 ?

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Why length(to_char(1::integer, '9')) = 2 ?
Date: 2011-03-09 13:19:18
Message-ID: 4D777E56.8080708@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 09/03/2011 13:15, Pavel Stehule wrote:
> 2011/3/9 Dmitriy Igrishin<dmitigr(at)gmail(dot)com>:
>> Hey all,
>>
>> dmitigr=> select to_char(1, '9');
>> to_char
>> ---------
>> 1
>>
>> dmitigr=> select length(to_char(1, '9'));
>> length
>> --------
>> 2
>>
>> Why to_char() includes preceding blank space in the result ?
>
> it is compatibility with Oracle?

I've often wondered too why there is padding by default in certain uses
of to_char().... it's a bit of a PITA sometimes. :-)

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sim Zacks 2011-03-09 13:25:29 Re: Why length(to_char(1::integer, '9')) = 2 ?
Previous Message Pavel Stehule 2011-03-09 13:15:36 Re: Why length(to_char(1::integer, '9')) = 2 ?