Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 782A563367C for ; Mon, 25 May 2009 12:16:52 -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 55782-08 for ; Mon, 25 May 2009 12:16:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from n77.bullet.mail.sp1.yahoo.com (n77.bullet.mail.sp1.yahoo.com [98.136.44.45]) by mail.postgresql.org (Postfix) with SMTP id D60216331F9 for ; Mon, 25 May 2009 12:16:48 -0300 (ADT) Received: from [69.147.84.144] by n77.bullet.mail.sp1.yahoo.com with NNFMP; 25 May 2009 15:16:47 -0000 Received: from [69.147.65.163] by t6.bullet.mail.sp1.yahoo.com with NNFMP; 25 May 2009 15:16:47 -0000 Received: from [127.0.0.1] by omp408.mail.sp1.yahoo.com with NNFMP; 25 May 2009 15:16:47 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 437288.39377.bm@omp408.mail.sp1.yahoo.com Received: (qmail 54843 invoked by uid 60001); 25 May 2009 15:16:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s1024; t=1243264607; bh=r2Gd5S/gbvoTTnLEadox2CtSa/kfXpXF2OIYUM3YKN8=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=vT4JluI2e0IPFH6fFEmuYOi/doIpz2VSIBbK+6IGSyrQNjGGd9nIQFmAr5BcpEJnq3w2kqNE1USDHJPHzzLMPgjAGW3T122zYbphBtMxQFgWz8pjXUvCbt60OGZa2oHecLwPjiujSOfPBfWvuoTPKHJnPAWXdBWZJzSjY4WTFZU= 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:Content-Transfer-Encoding; b=fMNDZ4cHkvqMbt35bNAiUr/RD+qtTzvhCin+ej42Zi2PI45g4b1TE+c/4ZLzVN+sDJRKYqu4pENbn5ro6Mluu4W83RNwQSkEIfCT14ms0X/G/49i6FhlgBAXniWUGCbTZ7VvNK1GU0blIziRPkEGL4Tcis9Uqkxp7FYk/tV/qyw=; Message-ID: <185722.54227.qm@web45103.mail.sp1.yahoo.com> X-YMail-OSG: 720o2p4VM1n9xGx4QTeMCK31.yyPwJMO4ILhWA_BQrdvQFcX0Yx_LzCKYalFCxtj9fUtOF5FfkeI.VLN4csjpX7ggNlu4eRjedXNUkJj7UtQ_ohSsmULFeByo5Wb02g_D6chekl1Mr8HjPr9DvLnQIJjDzdlWwnQzoD7TLyiTmeCU_EpGAo49h7Rq9PALQfkfxEkD3OzBQZUZ.M25CySKqQU3IifaLJX8k7cgKCPq4IHUxKQaCW15kq4mQ7hel0uacduPXjLjRt1suMbKBtXASWcp2hdQeK8XFLSpZh9ruYlwRTeTy2V Received: from [207.164.182.8] by web45103.mail.sp1.yahoo.com via HTTP; Mon, 25 May 2009 08:16:46 PDT X-Mailer: YahooMailClassic/5.3.9 YahooMailWebService/0.7.289.10 Date: Mon, 25 May 2009 08:16:46 -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=iso-8859-1 Content-Transfer-Encoding: quoted-printable 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/100 X-Sequence-Number: 19650 Hi Everyone,=0A=0AI have a problem with a prepare statement rounding the nu= meric fields.=0A=0AI have 2 inserts into a numeric field. The first insert = is using an update statement and the second one a prepared statement.=0AIt = looks like the prepared statement is doing a rounding on the inserted valu= e....=0A =0AFirst insert:=0A sql.executeUpdate("insert into jdbc_d= emo values (2.6999999999999997)");=0APostgresql log for the first insert:= =0A=A0 =A0 =A0 =A0 =A0 insert into jdbc_demo values (2.6999999999999997)=0A= The value in the database:=0A=A0 =A0 =A0 =A0 =A0 2.6999999999999997=0A=A0 = =0ASecond Insert:=0A PreparedStatement ps =3D db.prepareStatement(= "insert into jdbc_demo values (?)");=0A =A0=A0=A0ps.setDouble(1,2.699= 9999999999997);=0A =A0=A0=A0ps.executeUpdate();=0A =A0=A0=A0ps.= close();=0APostgresql log for the second insert:=0A=A0 =A0 =A0 =A0 =A0=A0= =A0insert into jdbc_demo values ($1) parameters: $1 =3D '2.6999999999999997= '=0AThe value in the database:=0A =A0 =A0 =A0 =A0 =A0 2.7=0A =0ADoes anyone= know why this is happening and if is a jdbc or postgres issue?=0A=0AThanks= a lot,=0AIoana Danes=0A=0A=0A=0A ____________________________________= ______________________________=0ALooking for the perfect gift? Give the gif= t of Flickr! =0A=0Ahttp://www.flickr.com/gift/