WIP: Relaxing the constraints on numeric scale

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема WIP: Relaxing the constraints on numeric scale
Дата
Msg-id CAEZATCWdNLgpKihmURF8nfofP0RFtAKJ7ktY6GcZOPnMfUoRqA@mail.gmail.com
обсуждение исходный текст
Ответы Re: WIP: Relaxing the constraints on numeric scale  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
When specifying NUMERIC(precision, scale) the scale is constrained to
the range [0, precision], which is per SQL spec. However, at least one
other major database vendor intentionally does not impose this
restriction, since allowing scales outside this range can be useful.

A negative scale implies rounding before the decimal point. For
example, a column declared as NUMERIC(3,-3) rounds values to the
nearest thousand, and can hold values up to 999000.

(Note that the display scale remains non-negative, so all digits
before the decimal point are displayed, and none of the internals of
numeric.c need to worry about negative dscale values. Only the scale
in the typemod is negative.)

A scale greater than the precision constrains the value to be less
than 0.1. For example, a column declared as NUMERIC(3,6) can hold
"micro" quantities up to 0.000999.

Attached is a WIP patch supporting this.

Regards,
Dean

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] Make jsonapi usable from libpq
Следующее
От: Ranier Vilela
Дата:
Сообщение: Re: Pipeline mode and PQpipelineSync()