Re: Why length(to_char(1::integer, '9')) = 2 ? - Mailing list pgsql-general

From Bruce Momjian
Subject Re: Why length(to_char(1::integer, '9')) = 2 ?
Date
Msg-id 201103111548.p2BFmj327143@momjian.us
Whole thread Raw
In response to Re: Why length(to_char(1::integer, '9')) = 2 ?  (Dmitriy Igrishin <dmitigr@gmail.com>)
List pgsql-general
Dmitriy Igrishin wrote:
> 2011/3/10 Bruce Momjian <bruce@momjian.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@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index f746ed6..da45970 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -5446,7 +5446,7 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
       <tbody>
        <row>
         <entry><literal>FM</literal> prefix</entry>
-        <entry>fill mode (suppress padding blanks and zeroes)</entry>
+        <entry>fill mode (suppress padding blanks and trailing zeroes)</entry>
         <entry><literal>FMMonth</literal></entry>
        </row>
        <row>
@@ -5812,7 +5812,7 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
       <tbody>
        <row>
         <entry><literal>FM</literal> prefix</entry>
-        <entry>fill mode (suppress padding blanks and zeroes)</entry>
+        <entry>fill mode (suppress padding blanks and trailing zeroes)</entry>
         <entry><literal>FM9999</literal></entry>
        </row>
        <row>

pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: Huge spikes in number of connections doing "PARSE"
Next
From: akp geek
Date:
Subject: ERROR: Failed with error 22007-invalid value "" for "mm" vacuumdb