Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ynbta-0004h6-2p for pgsql-jdbc@arkaria.postgresql.org; Thu, 30 Apr 2015 00:00:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YnbtZ-0001I6-IA for pgsql-jdbc@arkaria.postgresql.org; Thu, 30 Apr 2015 00:00:01 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YnbtX-0001Ho-Iq for pgsql-jdbc@postgresql.org; Wed, 29 Apr 2015 23:59:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1YnbtU-0000ZO-VH for pgsql-jdbc@postgresql.org; Wed, 29 Apr 2015 23:59:58 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t3TNxpfT004523; Wed, 29 Apr 2015 19:59:51 -0400 From: Tom Lane To: Dave Cramer cc: Timo Nentwig , List Subject: Re: float8 transmitted in ascii In-reply-to: References: Comments: In-reply-to Dave Cramer message dated "Wed, 29 Apr 2015 18:51:34 -0400" Date: Wed, 29 Apr 2015 16:59:52 -0700 Message-ID: <35729.1430351992@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org Dave Cramer writes: > If I understand you correctly in java you did: > select 47.88::DOUBLE PRECISION, > (47.88::DOUBLE PRECISION)::text, > (47.88::DOUBLE PRECISION)::numeric, > replace((47.88::DOUBLE PRECISION)::text, '.', ','); > and the two numeric values are correct, but the text values are wrong ? extra_float_digits explains it all, I'm sure. regression=# select 47.88::DOUBLE PRECISION, (47.88::DOUBLE PRECISION)::text, (47.88::DOUBLE PRECISION)::numeric, replace((47.88::DOUBLE PRECISION)::text, '.', ','); float8 | text | numeric | replace --------+-------+---------+--------- 47.88 | 47.88 | 47.88 | 47,88 (1 row) regression=# set extra_float_digits = 3; SET regression=# select 47.88::DOUBLE PRECISION, (47.88::DOUBLE PRECISION)::text, (47.88::DOUBLE PRECISION)::numeric, replace((47.88::DOUBLE PRECISION)::text, '.', ','); float8 | text | numeric | replace ---------------------+---------------------+---------+--------------------- 47.8800000000000026 | 47.8800000000000026 | 47.88 | 47,8800000000000026 (1 row) regards, tom lane -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc