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

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, Sim Zacks <sim(at)compulab(dot)co(dot)il>
Subject: Re: Why length(to_char(1::integer, '9')) = 2 ?
Date: 2011-03-11 15:48:45
Message-ID: 201103111548.p2BFmj327143@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dmitriy Igrishin wrote:
> 2011/3/10 Bruce Momjian <bruce(at)momjian(dot)us>
>
> > Dmitriy Igrishin wrote:
> > > dmitigr=> SELECT '>'||to_char(0.1, '0.99999')||'<' AS v;
> > > v
> > > ------------
> > > > 0.10000<
> > >
> > > dmitigr=> SELECT '>'||to_char(0.1, 'FM0.99999')||'<' AS v;
> > > v
> > > -------
> > > >0.1<
> > >
> > > So, padding zeroes suppressed by FM is a rest of the value.
> >
> > Any documentation changes suggested?
> >
> I propose to replace "fill mode (suppress padding blanks and zeroes)"
> located here
> http://www.postgresql.org/docs/9.0/static/functions-formatting.html#FUNCTIONS-FORMATTING-NUMERICMOD-TABLE
> with
> "fill mode (suppress padding blanks and trailing zeroes)".

Thanks. Attached patch applied.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

Attachment Content-Type Size
/rtmp/to_char.diff text/x-diff 914 bytes

In response to

Browse pgsql-general by date

  From Date Subject
Next Message akp geek 2011-03-11 15:54:57 ERROR: Failed with error 22007-invalid value "" for "mm" vacuumdb
Previous Message hubert depesz lubaczewski 2011-03-11 15:13:52 Re: Huge spikes in number of connections doing "PARSE"