Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 9DC5E63367C for ; Mon, 25 May 2009 12:05:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 53121-06 for ; Mon, 25 May 2009 12:05:38 -0300 (ADT) X-Greylist: delayed 00:05:42.788253 by SQLgrey-1.7.6 Received: from n67.bullet.mail.sp1.yahoo.com (n67.bullet.mail.sp1.yahoo.com [98.136.44.47]) by mail.postgresql.org (Postfix) with SMTP id C85716331F9 for ; Mon, 25 May 2009 12:05:37 -0300 (ADT) Received: from [216.252.122.219] by n67.bullet.mail.sp1.yahoo.com with NNFMP; 25 May 2009 14:59:53 -0000 Received: from [69.147.84.109] by t4.bullet.sp1.yahoo.com with NNFMP; 25 May 2009 14:59:53 -0000 Received: from [127.0.0.1] by omp207.mail.sp1.yahoo.com with NNFMP; 25 May 2009 14:59:53 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 654228.52005.bm@omp207.mail.sp1.yahoo.com Received: (qmail 82134 invoked by uid 60001); 25 May 2009 14:59:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s1024; t=1243263593; bh=aK+X54hgeOMEbTDCmGx1Hs8wUbxPq2hw7T/LJFpSxkE=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=q4RIRzVpfd33uQUzMkOiHhElmon1dUugyfrelu8iS3uzwyKx5W48usw18kUgd+I06zibEiVRLoJJjr3IIMA1G6Jd49+P7l0Ee3y75yjCOBFinqtKGgiuUZd18zHUvIoF+8DVal6UDnotozKq4W4yuXXntSq4RlxrMhUTsLKTY9U= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.ca; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=Wf5oDD8LjTmwnxwO+RjdtbQJtEZOI0+bkcuH1yQRXSNtVTODp/npTdffmdZYpsFuKFIGaByYSmBckN3JdFeK/wCNkLJ5VVVIUxfUKMaUTV/dlGg8aP4YhysqGPpDuxTHONzzUzpem9XSntqmLMV4e9MZ0vYUEVOeWmGfgKdUZYo=; Message-ID: <443343.82078.qm@web45109.mail.sp1.yahoo.com> X-YMail-OSG: TU8YpXQVM1mMOeT5pmqw8VSOLWTtjoGUVUDVOQX.dtdEh38skNcpesFk9Tcj26auZCn.O6DSHSjDCLUVVcYTSYe3f9iWZoYwFcL9iG9N8wx_zG1ePDUDVmmAXEC.h2mOa2J0JB8vH1CX9KlDMBfrJsy_d8FedPMAQHew3xj4J0UEe1lSJBvbDdGBemt2bjpY6IH8zWNuv7VGuZgGsKuDW.hTeoz22GqeX9p1FujK2.7rOJh75QUF_ucamhZfuXLDDrwi4noNjI.zdlejFbo8lAH6N9Chcwkl1Pa0ZDInq.cXfCSlH.SW Received: from [207.164.182.8] by web45109.mail.sp1.yahoo.com via HTTP; Mon, 25 May 2009 07:59:53 PDT X-Mailer: YahooMailClassic/5.3.9 YahooMailWebService/0.7.289.10 Date: Mon, 25 May 2009 07:59:53 -0700 (PDT) From: Ioana Danes Subject: jdbc rounding value for numeric fields To: pgsql-jdbc@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200905/98 X-Sequence-Number: 19648 Hi Everyone, I have a problem with a prepare statement rounding the numeric fields. I have 2 inserts into a numeric field. The first insert is using an update statement and the second one a prepared statement. It looks like the prepared statement is doing a rounding on the inserted value.... First insert: sql.executeUpdate("insert into jdbc_demo values (2.6999999999999997)"); Postgresql log for the first insert: insert into jdbc_demo values (2.6999999999999997) The value in the database: 2.6999999999999997 Second Insert: PreparedStatement ps = db.prepareStatement("insert into jdbc_demo values (?)"); ps.setDouble(1,2.6999999999999997); ps.executeUpdate(); ps.close(); Postgresql log for the second insert: insert into jdbc_demo values ($1) parameters: $1 = '2.6999999999999997' The value in the database: 2.7 Does anyone know why this is happening and if is a jdbc or postgres issue? Thanks a lot, Ioana Danes __________________________________________________________________ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/