Re: Numeric field quirk [Again]

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Matthew Hagerty <matthew(at)venux(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Numeric field quirk [Again]
Date: 2000-10-09 17:02:36
Message-ID: 200010091702.NAA01226@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Greetings,
>
> Well, it seems that the numeric issue I was having has nothing to do with
> the precision and scale being set the same, it has to do with the input
> data. The precision has to be at least 2 greater than the biggest number
> you need to enter, i.e.
>
> equinox=# create table test ( d numeric(4,2) );
> CREATE
> equinox=# insert into test values(10);
> INSERT 167844 1
> equinox=# insert into test values(101);
> ERROR: overflow on numeric ABS(value) >= 10^2 for field with precision 4
> scale 2

The variable above is 4 digits, with 2 digits to the right of the
decimal place. Doing numberic(3,3) allows insertion of 0.4, but not
4.0. This is expected.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(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

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-10-09 17:32:56 Re: ALTER TABLE DROP COLUMN
Previous Message Peter Eisentraut 2000-10-09 16:27:21 Re: [INTERFACES] Announcing PgSQL - a Python DB-API 2.0 compliant interface to PostgreSQL