Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 83C8063484E for ; Mon, 18 Jan 2010 06:10:00 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 56465-01-4 for ; Mon, 18 Jan 2010 10:09:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pw0-f44.google.com (mail-pw0-f44.google.com [209.85.160.44]) by mail.postgresql.org (Postfix) with ESMTP id 9B62D63472E for ; Mon, 18 Jan 2010 06:09:49 -0400 (AST) Received: by pwi15 with SMTP id 15so1750053pwi.3 for ; Mon, 18 Jan 2010 02:09:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type; bh=4XFBLQXTlts3tEuAK9uxUnW2jGlNy9aBatAIIQPjqJ8=; b=KKR3lupBbUcdiJ8sLbmzNsA4nw9KvlYtItcl2CtIh53XxliPyw39Om0o834GuGsaGe FyceXMu49JWvsQ3h6s+T4L5zLJr4S7T/pJLGqGegiDF3ZTb5nAjSTv5G9DV7odk19gOp ix8cQvaTG8nnFFOFp9dzSFiG6oAUcaFyOJsLc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; b=JtDBVM+evc3nSJd/WPEkn0wL0AUPVBH7vV05TtJ+XuHUDKnXb4Xg+svL3m2GbGTs2y gsSIWS1Qk9XRfHtSa+P1pwIvMn2T9yE9OXVQLXzuvcLGG6jkADCRdnjPSoZ8Bs3Su+P0 weeg3SLA24bI1LIFrUcj9+L+NZcbpdF/PqAMQ= MIME-Version: 1.0 Received: by 10.141.188.19 with SMTP id q19mr4197935rvp.164.1263809388060; Mon, 18 Jan 2010 02:09:48 -0800 (PST) In-Reply-To: <4B541C40.9040206@postnewspapers.com.au> References: <4B540B7D.1080306@b2bcentrum.cz> <4B541C40.9040206@postnewspapers.com.au> From: Greg Stark Date: Mon, 18 Jan 2010 10:09:28 +0000 X-Google-Sender-Auth: 73af628ad6907edc Message-ID: <407d949e1001180209v39e46a88v6d5a0e5a181a5d84@mail.gmail.com> Subject: Re: Mapping Java BigDecimal To: Craig Ringer Cc: =?UTF-8?B?SmFrdWIgQmVkbsOhxZk=?= , pgsql-jdbc@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201001/47 X-Sequence-Number: 20243 On Mon, Jan 18, 2010 at 8:30 AM, Craig Ringer wrote: > I don't know whether Oracle or Pg are more "correct" here - you're > giving Pg "3" so arguably it shouldn't assume "3.00" and should in fact > return "3". OTOH, you've told it what the scale and precision are for > the column, and inputs to the column should be presumed to fit that > scale and precision. > It doesn't really work that way. Whether you store "3" or "3.00" or "3.0000" you're storing the same value in the numeric field. The precision and scale you specify for Postgres is just the maximum as well. But it's also used for the default formatting when converting to text. If you retrieved the numeric in binary format it would be the same regardless of the parameters. In no case does postgres remember the precision of the input text. If you don't specify a precision on the column it just prints as many as necessar. That sounds like what you're looking for. -- greg