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 gianni.cio...@2ndquadrant.it | www.2ndquadrant.it
diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index 0bb6594..c426020 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -346,13 +346,13 @@ <entry><type>decimal</></entry> <entry>variable</entry> <entry>user-specified precision, exact</entry> - <entry>no limit</entry> + <entry>up to 131072 digits before the decimal point; up to 16383 digits after the decimal point</entry> </row> <row> <entry><type>numeric</></entry> <entry>variable</entry> <entry>user-specified precision, exact</entry> - <entry>no limit</entry> + <entry>up to 131072 digits before the decimal point; up to 16383 digits after the decimal point</entry> </row> <row> @@ -476,8 +476,8 @@ </indexterm> <para> - The type <type>numeric</type> can store numbers with up to 1000 - digits of precision and perform calculations exactly. It is + The type <type>numeric</type> can store numbers with a + large number of digits and perform calculations exactly. It is especially recommended for storing monetary amounts and other quantities where exactness is required. However, arithmetic on <type>numeric</type> values is very slow compared to the integer @@ -525,6 +525,15 @@ NUMERIC explicitly.) </para> + <note> + <para> + The maximum allowed precision when explicitely specified in the + type declaration is 1000; otherwise the current implementation + of the <type>NUMERIC</type> is subject to the limits described + in <xref linkend="datatype-numeric-table">. + </para> + </note> + <para> If the scale of a value to be stored is greater than the declared scale of the column, the system will round the value to the specified
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers