pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: Greg Stark <gsstark@mit.edu>
Cc: Jakub Bednář <jakub.bednar@b2bcentrum.cz>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Mapping Java BigDecimal
Date: Tue, 19 Jan 2010 12:37:47 +0800
Message-ID: <4B55371B.40105@postnewspapers.com.au> (raw)
In-Reply-To: <407d949e1001180209v39e46a88v6d5a0e5a181a5d84@mail.gmail.com>
References: <4B540B7D.1080306@b2bcentrum.cz>
	<4B541C40.9040206@postnewspapers.com.au>
	<407d949e1001180209v39e46a88v6d5a0e5a181a5d84@mail.gmail.com>

On 18/01/2010 6:09 PM, Greg Stark wrote:
> On Mon, Jan 18, 2010 at 8:30 AM, Craig Ringer
> <craig@postnewspapers.com.au>  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.
>>

> 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.

Then I'm confused:

regress=> create table test (x numeric);
CREATE TABLE                        ^
regress=> insert into test (x) values ('3');
INSERT 0 1
regress=> insert into test (x) values ('3.0');
INSERT 0 1
regress=> insert into test (x) values ('3.00');
INSERT 0 1
regress=> insert into test (x) values ('3.000');
INSERT 0 1
regress=> select * from test;
    x
-------
      3
    3.0
   3.00
  3.000
(4 rows)



--
Craig Ringer



view thread (15+ messages)  latest in thread

Message-ID: <4B55371B.40105@postnewspapers.com.au>
Permalink:  ../4B55371B.40105@postnewspapers.com.au/
Also on:    postgresql.org/message-id/4B55371B.40105@postnewspapers.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: craig@postnewspapers.com.au, gsstark@mit.edu, jakub.bednar@b2bcentrum.cz
  Subject: Re: Mapping Java BigDecimal
  In-Reply-To: <4B55371B.40105@postnewspapers.com.au>
  References: <4B540B7D.1080306@b2bcentrum.cz> <4B541C40.9040206@postnewspapers.com.au> <407d949e1001180209v39e46a88v6d5a0e5a181a5d84@mail.gmail.com> <4B55371B.40105@postnewspapers.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox