Re: [doc patch] extra_float_digits and casting from real to numeric

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Christoph Berg <christoph(dot)berg(at)credativ(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [doc patch] extra_float_digits and casting from real to numeric
Date: 2014-02-05 18:49:00
Message-ID: CA+TgmoZY4KKapTkf2PXCoQnT-jb0YSP8w2PhP_qge62NiLv5oA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 4, 2014 at 11:25 AM, Christoph Berg
<christoph(dot)berg(at)credativ(dot)de> wrote:
> Re: To Tom Lane 2014-01-08 <20140108094017(dot)GA20317(at)msgid(dot)df7cb(dot)de>
>> What about this patch to mention this gotcha more explicitely in the
>> documentation?
>>
>> diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
>> new file mode 100644
>> index 0386330..968f4a7
>> *** a/doc/src/sgml/datatype.sgml
>> --- b/doc/src/sgml/datatype.sgml
>> *************** NUMERIC
>> *** 689,694 ****
>> --- 689,697 ----
>> <literal>0</literal>, the output is the same on every platform
>> supported by PostgreSQL. Increasing it will produce output that
>> more accurately represents the stored value, but may be unportable.
>> + Casts to other numeric datatypes and the <literal>to_char</literal>
>> + function are not affected by this setting, it affects only the text
>> + representation.
>> </para>
>> </note>
>>
>
> Anyone for that patch?

Well, the new text kinda recapitulates what the existing text already
says. If we're going to clarify, I'd do it like this:

The <xref linkend="guc-extra-float-digits"> setting controls the
number of extra significant digits included when a floating point
value is converted to text for output. It does not affect the results
when a floating point number is converted to some other data type
or formatted using <literal>to_char</literal>.

But frankly I'm inclined to just leave it alone. It says that it
affects what happens when the value "is converted to text for output".
That's specific and accurate. Granted, someone could misunderstand,
but that's true of almost anything we might write, and being too
long-winded has costs of its own.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2014-02-05 18:56:54 Re: narwhal and PGDLLIMPORT
Previous Message Peter Eisentraut 2014-02-05 18:48:40 Re: should we add a XLogRecPtr/LSN SQL type?