Re: [HACKERS] numeric & decimal

From: José Soares <jose(at)sferacarta(dot)com>
To: Jan Wieck <jwieck(at)debis(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] numeric & decimal
Date: 1999-04-28 13:02:36
Message-ID: 372706EC.56E37CE6@sferacarta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jan Wieck ha scritto:

> > Hi all,
> >
> > I'm trying numeric & decimal types in v6.5beta1 and I have two questions
> > about it.
> >
> > [...]
> >
> > Second question:
> > Why PostgreSQL allows to insert 14 digits into a numeric(5,1) ?
> >
> > create table test(
> > n numeric(10,3),
> > d decimal(5,1)
> > );
>
> For some reason (dunno why) the parser ignores the precision
> for DECIMAL. atttypmod is set hardcoded to -1. So the above
> is identical to a
>
> CREATE TABLE test (n numeric(10,3), d decimal);
>
> I'll test what happens if I enable it in gram.y and if it
> doesn't break any regression commit the changes.
>
> Jan
>

Great!
I have other questions about NUMERICs:

> create table test(
> num0 numeric,
> num1 numeric(1),
> num4 numeric(4,1)
> );
> CREATE
> insert into test values (11111111,11111111,-9,9,-999.99,-999.99);
> INSERT 78190 1
> select * from test;
> num0|num1| num4
> ---------------+----+-------
> 11111111.000000| 9|-1000.0
> ^^^^^^ ^^^^^^^

- I don't understand this default:
NUMERIC without size is interpreted as NUMERIC(x,6). Why ?
Standard SQL92 says that NUMERIC without size is equivalent to NUMERIC(1)

- NUMERIC(4,1) transalte value -999.99 as -1000.0 (greater than his size)

Comments?

José

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Cary O'Brien 1999-04-28 13:04:14 Re: [HACKERS] Hacker found bug in Postgres ?
Previous Message The Hermit Hacker 1999-04-28 12:31:50 Re: [HACKERS] v6.5 Release Date ...