pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Merlin Moncure <mmoncure@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Greg Stark <gsstark@mit.edu>
Cc: Nathan M. Davalos <n.davalos@sharedmarketing.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Function trunc() behaves in unexpected manner with different data types
Date: Fri, 25 Feb 2011 09:28:25 -0600
Message-ID: <AANLkTimeaNH81TemEzunroX6iotxpAceDFLMPY=7Lw12@mail.gmail.com> (raw)
In-Reply-To: <21330.1298647285@sss.pgh.pa.us>
References: <2701CF596B80DC44815FDBFFF5881A1E0104BB63@exchange01.sharedmarketing.com>
	<AANLkTimWoBDGLN282PLRkg2eCuZTS6KJCEH_m0uQHrb-@mail.gmail.com>
	<AANLkTin81WeP3+gOjyp6bX-m26vUjcBRBd2GRGkWwMxZ@mail.gmail.com>
	<AANLkTinjSDnwhKXWqJNMTnxah75-RJf2A4svXBsqP_Fh@mail.gmail.com>
	<21330.1298647285@sss.pgh.pa.us>

On Fri, Feb 25, 2011 at 9:21 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Merlin Moncure <mmoncure@gmail.com> writes:
>> right -- in understand how floating point works -- but are you are
>> saying that you are ok with the fact that (for example) a table with a
>> floating point unique key could dump and not restore? more
>> specifically, a binary dump would restore but a text dump would not.
>
> pg_dump takes measures against that (see extra_float_digits).
>
>> I think this is a problem with our implementation -- not all versions
>> of 2183.68 as outputted from the server are the same internally.
>
> It's an inherent property of float math.  Yes, we could set the default
> value of extra_float_digits high enough that distinct internal values
> always had distinct text representations, but trust me, you would not
> like it.

no I wouldn't, and the pg_dump extra_float_digits setting addresses my
primary concern.  The client has a similar issue though -- suppose it
fetches a value from the server and updates it back -- which record
gets the update?  You would get different results if the client was
using binary or text features of the protocol.  Not saying this is
wrong or needs to be fixed, just pointing it out :-).

update foo set val=val + 1 where val = 2183.68;

merlin



view thread (9+ messages)  latest in thread

Message-ID: <AANLkTimeaNH81TemEzunroX6iotxpAceDFLMPY=7Lw12@mail.gmail.com>
Permalink:  ../AANLkTimeaNH81TemEzunroX6iotxpAceDFLMPY=7Lw12@mail.gmail.com/
Also on:    postgresql.org/message-id/AANLkTimeaNH81TemEzunroX6iotxpAceDFLMPY=7Lw12@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: mmoncure@gmail.com, tgl@sss.pgh.pa.us, gsstark@mit.edu, n.davalos@sharedmarketing.com
  Subject: Re: Function trunc() behaves in unexpected manner with different data types
  In-Reply-To: <AANLkTimeaNH81TemEzunroX6iotxpAceDFLMPY=7Lw12@mail.gmail.com>
  References: <2701CF596B80DC44815FDBFFF5881A1E0104BB63@exchange01.sharedmarketing.com> <AANLkTimWoBDGLN282PLRkg2eCuZTS6KJCEH_m0uQHrb-@mail.gmail.com> <AANLkTin81WeP3+gOjyp6bX-m26vUjcBRBd2GRGkWwMxZ@mail.gmail.com> <AANLkTinjSDnwhKXWqJNMTnxah75-RJf2A4svXBsqP_Fh@mail.gmail.com> <21330.1298647285@sss.pgh.pa.us> <AANLkTimeaNH81TemEzunroX6iotxpAceDFLMPY=7Lw12@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox