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

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why length(to_char(1::integer, '9')) = 2 ?
Date: 2011-03-09 13:31:15
Message-ID: AANLkTimYEqQAVP=utVa8FB155R1FaBDLKnhJQGKDQqgq@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2011/3/9 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>

> 2011/3/9 Dmitriy Igrishin <dmitigr(at)gmail(dot)com>:
> >
> >
> > 2011/3/9 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> >>
> >> 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?
> >
> > Do you mean the case of MI ?
> > So, is this leading space reserved for a sign of number by default ?
>
> yes
>
> pavel=# select '>' || to_char(-1,'9') || '<';
> ?column?
> ──────────
> >-1<
> (1 row)
>

Aha! Thanks.

>
> regards
>
> Pavel
>
> >>
> >> Regards
> >>
> >> Pavel
> >>
> >> >
> >> > --
> >> > // Dmitriy.
> >> >
> >> >
> >> >
> >
> >
> >
> > --
> > // Dmitriy.
> >
> >
> >
>

--
// Dmitriy.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dmitriy Igrishin 2011-03-09 13:34:41 Re: Why length(to_char(1::integer, '9')) = 2 ?
Previous Message Pavel Stehule 2011-03-09 13:29:17 Re: Why length(to_char(1::integer, '9')) = 2 ?