Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 54B46B5DCA8 for ; Sat, 16 Jul 2011 09:28:08 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 70292-03 for ; Sat, 16 Jul 2011 12:28:02 +0000 (UTC) X-Greylist: delayed 00:06:23.437703 by SQLgrey-1.7.6 Received: from tyo200.gate.nec.co.jp (TYO200.gate.nec.co.jp [202.32.8.215]) by mail.postgresql.org (Postfix) with ESMTP id E7C98B5DC99 for ; Sat, 16 Jul 2011 09:28:01 -0300 (ADT) Received: from tyo202.gate.nec.co.jp ([10.7.69.202]) by tyo200.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id p6GCS0cf012155 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 16 Jul 2011 21:28:00 +0900 (JST) Received: from mailgate3.nec.co.jp ([10.7.69.195]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id p6GCLaWX004999 for ; Sat, 16 Jul 2011 21:21:36 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id p6GCLaW26038 for pgsql-bugs@postgresql.org; Sat, 16 Jul 2011 21:21:36 +0900 (JST) Received: from mail03.kamome.nec.co.jp (mail03.kamome.nec.co.jp [10.25.43.7]) by mailsv4.nec.co.jp (8.13.8/8.13.4) with ESMTP id p6GCLZKr026274 for ; Sat, 16 Jul 2011 21:21:35 +0900 (JST) Received: from shikibu.jp.nec.com ([10.26.220.2] [10.26.220.2]) by mail02.kamome.nec.co.jp with ESMTP id BT-MMP-129496; Sat, 16 Jul 2011 21:21:08 +0900 Received: from mxc.nes.nec.co.jp ([10.21.36.169] [10.21.36.169]) by mail.jp.nec.com with ESMTP; Sat, 16 Jul 2011 21:21:05 +0900 From: Akira Kurosawa To: pgsql-bugs@postgresql.org Cc: iwaasa@mxs.nes.nec.co.jp Subject: Re: BUG #6096: ECPG set precision of double value to 14 digits Date: Sat, 16 Jul 2011 21:21:04 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: HidemaruMail 5.38 (WinNT,501) Message-Id: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=-5 required=5 tests=BAYES_40=-0.001, RP_MATCHES_RCVD=0.001 X-Spam-Level: X-Archive-Number: 201107/126 X-Sequence-Number: 30738 Hi, I built PostgreSQL 8.4.8 with the following patch, then executed same program. This result is same as psql's one. -------------------------------------------------- testdb=# SELECT * FROM double_table; c1 ------------------- 12345678901234 1234567890.1234 0.12345678901234 123456789012345 1234567890.12345 0.123456789012345 (6 rows) -------------------------------------------------- *** execute.c.org 2011-04-15 12:17:14.000000000 +0900 --- execute.c 2011-07-16 19:46:05.000000000 +0900 *************** *** 709,720 **** strcpy(mallocedval, "array ["); for (element = 0; element < asize; element++) ! sprintf(mallocedval + strlen(mallocedval), "%.14g,", ((double *) var->value)[element]); strcpy(mallocedval + strlen(mallocedval) - 1, "]"); } else ! sprintf(mallocedval, "%.14g", *((double *) var->value)); *tobeinserted_p = mallocedval; break; --- 709,720 ---- strcpy(mallocedval, "array ["); for (element = 0; element < asize; element++) ! sprintf(mallocedval + strlen(mallocedval), "%.15g,", ((double *) var->value)[element]); strcpy(mallocedval + strlen(mallocedval) - 1, "]"); } else ! sprintf(mallocedval, "%.15g", *((double *) var->value)); *tobeinserted_p = mallocedval; break;