Re: [SQL] Decimal precsion?

From: wieck(at)debis(dot)com (Jan Wieck)
To: maillist(at)candle(dot)pha(dot)pa(dot)us (Bruce Momjian)
Cc: zot(at)zotconsulting(dot)com, pgsql-sql(at)postgreSQL(dot)org, jwieck(at)debis(dot)com
Subject: Re: [SQL] Decimal precsion?
Date: 1999-10-30 15:43:48
Message-ID: m11hafU-0003kLC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>
> >
> > Yeah I finnally figured that out, wish the docs would cover things like
> > that.
> >
> > I went through two books (which said its just liek COBOL! and then
> > ignored me) and finnally the mysql pages had a good right up.
> >
> > I still thing the 0.0 thing is an error.
> >
>
> Yes, and why doesn't this generate an error:
>
> test=> insert into example values(0.12345);
> INSERT 19488 1
> test=> insert into example values(0.1234567);
> INSERT 19489 1
> test=> select * from example;
> other
> ------
> 0.1235
> 0.1235
> (2 rows)
>
> Jan, can you comment on this. I found the code in numeric.c, but can't
> figure out what the proper test should be.

Haven't seen the original message, but it looks to me that
the column is declared as decimal with 4 digits after the
decimal point. Therefore, all values get rounded at the time
of INSERT/UPDATE. The above looks numerically right to me.

Isn't that behaviour correct? Does the standard define
something else?

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#========================================= wieck(at)debis(dot)com (Jan Wieck) #

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 1999-10-30 15:55:20 Re: [SQL] Decimal precsion?
Previous Message Tom Lane 1999-10-30 04:11:11 Re: [SQL] tuning large selects