Re: [HACKERS] numeric & decimal

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: "[Jos_] Soares" <jose(at)sferacarta(dot)com>
Cc: Jan Wieck <jwieck(at)debis(dot)com>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] numeric & decimal
Date: 1999-05-10 16:37:04
Message-ID: 199905101637.MAA07515@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


This looks like something that should be addressed. Was it?

[Charset iso-8859-1 unsupported, filtering to ASCII...]
> 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_
>

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-05-10 16:38:51 Re: [HACKERS] Parser bug: alias is a "non-group column"?
Previous Message Tom Lane 1999-05-10 16:31:08 Re: [HACKERS] 64-bit hashjoins