Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 2F3059FB2C4 for ; Thu, 18 Jan 2007 18:02:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 30526-04 for ; Thu, 18 Jan 2007 18:02:41 -0400 (AST) X-Greylist: delayed 00:13:39.833897 by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 5BDF59FB304 for ; Thu, 18 Jan 2007 18:02:44 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by svr4.postgresql.org (Postfix) with ESMTP id 33BD25AFA27 for ; Thu, 18 Jan 2007 21:49:00 +0000 (GMT) Received: from [219.89.217.179] (helo=[10.1.1.3]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1H7f7m-0004hD-1p; Fri, 19 Jan 2007 10:48:47 +1300 Message-ID: <45AFEC9C.7080102@opencloud.com> Date: Thu, 18 Jan 2007 21:54:36 +0000 From: Oliver Jowett User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Todd Shoemaker Cc: pgsql-jdbc@postgresql.org Subject: Re: Default numeric scale of zero in JDBC? References: <20070118170551.88504.qmail@web53608.mail.yahoo.com> In-Reply-To: <20070118170551.88504.qmail@web53608.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Broken-Reverse-DNS: no host name found for IP address 219.89.217.179 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.245 tagged_above=0 required=5 tests=AWL, BAYES_95 X-Spam-Level: * X-Archive-Number: 200701/119 X-Sequence-Number: 16484 Todd Shoemaker wrote: > Hello, > > I downloaded the jdbc source and noted that if I specified a default scale of 4 in AbstractJdbc2ResultSetMetadata.getScale() (if the column is numeric and the scale is -1), I received the desired results. I further updated the code to provide a private DEFAULT_NUMERIC_PRECISION that defaults to 4, which can be overridden with the System property org.postgresql.jdbc2.DEFAULT_NUMERIC_SCALE. I built this and tested it within Squirrel SQL and it works properly, and the system property is working to override this default. Would this be an update that the jdbc driver developers would be interested in? > > I suppose my other question is, what do other JDBC drivers default this to? Also, does this imply that others do not use non-integer arithmetic with sql through JDBC? Given that the reported metadata scale does not affect what the driver does at all, and all the computation is done on the server side, I'd say that any rounding that is happening is happening in whatever is using the driver's metadata ("Squirrel SQL?") -O