Re: [SQL] numeric question..
| От | Tom Lane |
|---|---|
| Тема | Re: [SQL] numeric question.. |
| Дата | |
| Msg-id | 20835.948044134@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: [SQL] numeric question.. (Peter Eisentraut <peter_e@gmx.net>) |
| Список | pgsql-sql |
Peter Eisentraut <peter_e@gmx.net> writes:
> NUMERIC specifies the data type exact numeric, with the decimal precision
> and scale specified by the <precision> and <scale>.
> DECIMAL specifies the data type exact numeric, with the decimal scale
> specified by the <scale> and the implementation-defined decimal precision
> equal to or greater than the value of the specified <precision>.
> Up to this day I'm wondering what exactly this means ...
Yeah, I read that too. I think what it means is that implementors are
allowed to increase the precision (field width) of a DECIMAL field to a
larger value if that's more efficient in their implementation, whereas
NUMERIC must have exactly the specified precision.
For example, if we were to reimplement NUMERIC using radix-10000
arithmetic (four decimal digits per 16-bit integer), then the most
efficient field widths would be multiples of 4. According to the spec,
we'd be allowed to increase the field width of a DECIMAL field to make
it a multiple of 4, but not the width of a NUMERIC field.
Right now, there is no such implementation advantage in Postgres, so
the two field types are exactly equivalent in our code.
regards, tom lane
В списке pgsql-sql по дате отправления: