Charles..
On Sun, May 22, 2016 at 9:18 PM, Charles <cooper.charles.m@gmail.com> wrote:
> As a follow-up question, I am a bit confused as to the following behavior:
>
> elsendb=> set extra_float_digits = 3;
...
> elsendb=> select 11143.15 :: float4 :: text :: float4;
...
> 11143.1504
> elsendb=> select 11143.15 :: float4 :: numeric :: float4;
...
> 11143.2002
> How come 11143.1504 is not printed in all of these cases?
Probably because extra_f_d only plays when converting to/from text,
and not to numeric. It really is a mechanism to insure that text dumps
+ restores do not modify data. The other way is to use hex or binary
floating ( %a in printf ) in dumps, which, IIRC, postgres did
understand on input but had no way to generate on output.
If you insist on mixing finite precisison binary fractions ( float )
with decimal fractions ( numeric and/or text ) you should be prepared
for this. Do not do it or use a text intermediate step always so you
can control it.
Francico Olarte.