Skip site navigation (1) Skip section navigation (2)

Re: Mapping Java BigDecimal

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Jakub Bednář <jakub(dot)bednar(at)b2bcentrum(dot)cz>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Mapping Java BigDecimal
Date: 2010-01-19 04:37:47
Message-ID: 4B55371B.40105@postnewspapers.com.au (view raw or flat)
Thread:
Lists: pgsql-jdbc
On 18/01/2010 6:09 PM, Greg Stark wrote:
> On Mon, Jan 18, 2010 at 8:30 AM, Craig Ringer
> <craig(at)postnewspapers(dot)com(dot)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

In response to

Responses

pgsql-jdbc by date

Next:From: Greg StarkDate: 2010-01-19 11:04:45
Subject: Re: Mapping Java BigDecimal
Previous:From: dmpDate: 2010-01-18 18:02:08
Subject: [Fwd: Re: Mapping Java BigDecimal]

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group