Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 6A4C01337B61 for ; Fri, 25 Feb 2011 11:28:33 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 15471-02 for ; Fri, 25 Feb 2011 15:28:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qw0-f46.google.com (mail-qw0-f46.google.com [209.85.216.46]) by mail.postgresql.org (Postfix) with ESMTP id 606841337B43 for ; Fri, 25 Feb 2011 11:28:25 -0400 (AST) Received: by qwd7 with SMTP id 7so1325068qwd.19 for ; Fri, 25 Feb 2011 07:28:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=gaiTsbVQohX0pzNj3iqxa7Ryw197fF/ZYkyGKt2i1kg=; b=fESurrX/xSQ4VCJuainRElsVyQ+5hwMMM9m5mRFrMpkQTOJPNEH+bph2SaTEfJ5/H3 NcNohWn57bGm/cgvRt9U/qCe9qGu11aNbUlPXhmF2yPH0y0H/5C1UUlY+AzQUkoo44mp 7abXob/1JqbjonXExdhxUwZMP8KG9uYSTWfwg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=EOD3pjmO/Zgf6MnkBVi8hEZmFuMZ52QrSeQZwpg1qkNMNkkBiVlr/TzAlxqzbfJD/Q aOHFqnBRPyNcvNeUUVJx4SMrqWrgiGF77zx851BT6TybGUfqJV71hjUawkyxpmTKRQsa VUJ0O9mS9GsHNPHqGpPLfVdcmEXGBwgIEbWgA= MIME-Version: 1.0 Received: by 10.229.245.14 with SMTP id ls14mr2010732qcb.19.1298647705722; Fri, 25 Feb 2011 07:28:25 -0800 (PST) Received: by 10.229.225.212 with HTTP; Fri, 25 Feb 2011 07:28:25 -0800 (PST) In-Reply-To: <21330.1298647285@sss.pgh.pa.us> References: <2701CF596B80DC44815FDBFFF5881A1E0104BB63@exchange01.sharedmarketing.com> <21330.1298647285@sss.pgh.pa.us> Date: Fri, 25 Feb 2011 09:28:25 -0600 Message-ID: Subject: Re: Function trunc() behaves in unexpected manner with different data types From: Merlin Moncure To: Tom Lane Cc: Greg Stark , "Nathan M. Davalos" , pgsql-bugs@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201102/219 X-Sequence-Number: 29491 On Fri, Feb 25, 2011 at 9:21 AM, Tom Lane wrote: > Merlin Moncure 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. =A0Yes, 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=3Dval + 1 where val =3D 2183.68; merlin