Re: Precision and scale of numeric column reported as value

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Precision and scale of numeric column reported as value
Дата
Msg-id 4241E333.2070305@opencloud.com
обсуждение исходный текст
Ответ на Re: Precision and scale of numeric column reported as value  (Sergio Lob <Sergio_Lob@iwaysoftware.com>)
Ответы Re: Precision and scale of numeric column reported as value  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Sergio Lob wrote:
> Precision is the number of total digits in the number. Scale is the
> number of  fractional digits.
> For instance, a column defined as NUMERIC(10,3)  should return
> precision=10, scale=3.

Yes, I understand that.

> The error only occurs for a column defined as
> NUMERIC  (without precision or scale specified). Presumably, there is a
> default precision and scale assigned to the column by postgreSQL, which
> is not -1.

There appears to be no default, which is why we currently return -1.

Scale should default to 0 per the standard, but defaults to whatever the
precision is in PostgreSQL (see the docs for details).

The docs claim an implementation precision limit of 1000, but that
doesn't seem to correspond to the actual implementation -- I can insert
and retrieve 2000 digits NUMERICs (for example) just fine. I can't see
an obvious limit on precision in the backend code. There may be a
theoretical limit somewhere around 2^30 digits, I think (limited by the
backend's memory allocation sanity checks), but I have not tested that.

Given that there is effectively no default, do you have suggestions for
a better value to return?

-O

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Andrew - Supernews
Дата:
Сообщение: Re: BUG #1552: massive performance hit between 7.4 and 8.0.1
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: BUG #1517: SQL interval syntax is accepted by the parser,