## Re: maximum digits for NUMERIC

From: Gianni Ciolli Noah Misch pgsql-hackers(at)postgresql(dot)org Re: maximum digits for NUMERIC 2011-04-01 10:44:23 20110401104423.GF6543@albo.gi.lan (view raw, whole thread or download thread mbox) 2011-03-11 11:36:14 from Gianni Ciolli  2011-03-11 14:38:03 from Tom Lane   2011-03-11 15:16:52 from Gianni Ciolli  2011-03-21 00:14:21 from Noah Misch   2011-03-25 08:46:17 from Gianni Ciolli    2011-03-25 18:09:54 from Gianni Ciolli     2011-04-01 07:52:22 from Noah Misch      2011-04-01 10:44:23 from Gianni Ciolli       2011-04-01 11:51:04 from Noah Misch        2011-04-03 23:57:34 from Robert Haas         2011-04-26 15:58:19 from Bruce Momjian          2011-04-27 03:38:17 from Alvaro Herrera           2011-04-27 03:47:52 from Bruce Momjian            2011-04-27 12:20:30 from Daniele Varrazzo pgsql-hackers
```On Fri, Apr 01, 2011 at 03:52:22AM -0400, Noah Misch wrote:

> NumericLong has a 14-bit count of decimal digits for the dscale, giving that
> fractional digit limit.  It stores the weight as a 16-bit signed count of
> base-10000 "digits" after the first.  For example, 10^4-1 has weight 0, 10^4
> through 10^8 - 1 have weight 1, 10^8 has weight 2, etc.  For purposes of hitting
> the positive limit, we have 15 bits of weight.  Therefore, it can represent up
> to 2^15 * 4 = 2^17 digits.

OK; thanks also for the explaination.

>
> > --- a/doc/src/sgml/datatype.sgml
> > +++ b/doc/src/sgml/datatype.sgml
>
> There's a table further up on this page that lists of the range of each type,
> with "no limit" listed for numeric.  It could use an update noting with the
> supported extremes and fractional digit limit.

OK.

Please find attached v2 of the numeric-doc patch, which takes into
account your remarks. In particular, numeric limits are now correct
and documented only in that table.

Best regards,
Dr. Gianni Ciolli - 2ndQuadrant Italia
PostgreSQL Training, Services and Support
```

Attachment: patch-numeric-doc-v2.diff
Description: text/x-diff (1.8 KB)

### pgsql-hackers by date

 Next: From: Heikki Linnakangas Date: 2011-04-01 11:24:53 Subject: Transforming IN (...) to ORs, volatility Previous: From: Magnus Hagander Date: 2011-04-01 08:34:26 Subject: Re: Should psql support URI syntax?