Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id CA9D49FB2E7 for ; Thu, 18 Jan 2007 10:13:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 93235-08 for ; Thu, 18 Jan 2007 10:12:49 -0400 (AST) X-Greylist: delayed 00:07:11.172653 by SQLgrey-1.7.4 Received: from web53601.mail.yahoo.com (web53601.mail.yahoo.com [206.190.37.34]) by postgresql.org (Postfix) with SMTP id 4EEA59FB2E6 for ; Thu, 18 Jan 2007 10:12:59 -0400 (AST) Received: (qmail 61511 invoked by uid 60001); 18 Jan 2007 14:05:43 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=uVQQQJW6FMaFHWaNtIDMdqBkwbY4CaKS70b5dukPpsw1Otu74AWHPhXQVpKeh1rWPI/xpW7phFkYmonGe8uormeuj0EN49cboXHmoqabB//04S8GBWJwqmv1PNKAvF723lxJGzqktgAZEfO4GEPw/DDA/YEjYmfDFjkGgOazemE= ; Message-ID: <20070118140542.61505.qmail@web53601.mail.yahoo.com> Received: from [208.254.250.196] by web53601.mail.yahoo.com via HTTP; Thu, 18 Jan 2007 06:05:42 PST Date: Thu, 18 Jan 2007 06:05:42 -0800 (PST) From: Todd Shoemaker Reply-To: Todd Shoemaker Subject: Default numeric scale of zero in JDBC? To: pgsql-jdbc@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=ascii 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= X-Spam-Level: X-Archive-Number: 200701/115 X-Sequence-Number: 16480 Hello,=0A=0AI have discovered that the jdbc driver apparently uses a defaul= t scale of zero decimal places for SQL numeric operators, including the sum= () aggregate operator. For example, this query:=0A=0Aselect (1.5 + 2);=0A= =0AThis returns 4 from jdbc, but it returns 3.5 when run from within PGAdmi= n. The only way I can coerce the value to return decimal places is to expl= icity cast the value to a numeric with scale:=0A=0Aselect cast(1.5 + 2 as n= umeric(10,2)) as value=0A=0AThis returns 3.5. =0A=0AAlso, queries like "se= lect sum(value) from table" returns a rounded value, even though the column= 'value' is numeric(16,2). Is there a magic vmparam or setting to default = the precision at the jdbc driver level? I am trying to run a large existin= g system on PostgreSQL and it is not feasible to hunt down all numeric oper= ations in thousands of classes to explicitly cast them. Have others have = encountered this issue?=0A=0AThanks,=0A=0A-Todd=0A=0A=0A=0A=0A