Re: [HACKERS] numeric & decimal

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [HACKERS] numeric & decimal
Дата
Msg-id 199905101637.MAA07515@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] numeric & decimal  (José Soares <jose@sferacarta.com>)
Ответы Re: [HACKERS] numeric & decimal  (jwieck@debis.com (Jan Wieck))
Список 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@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] 64-bit hashjoins
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Parser bug: alias is a "non-group column"?