decimal precision constrained

This commit is contained in:
Filipriec
2026-08-24 19:58:44 +02:00
parent 60aca940ee
commit 16670f4375
13 changed files with 147 additions and 25 deletions

View File

@@ -0,0 +1,26 @@
# Decimal column policy
Use the bare `numeric` column type for ordinary exact base-10 values. It stores
the value without a schema-defined decimal-place limit and is the recommended
choice for quantities, percentages, rates, ratios and measurements. Use
`money` for currency amounts; its currency and rounding policy are separate
from this document.
`decimal(p,s)` is an advanced, opt-in compatibility type for strict external
data contracts. `p` limits the total digits and `s` limits the fractional
digits. It is hidden from the normal table-designer type list until fixed-scale
decimal is enabled for that editing session.
Fixed scale is intentionally strict:
- API input outside the declared precision or scale is rejected, never
silently rounded by PostgreSQL.
- A table script targeting a fixed-scale column must round explicitly before
returning its value.
- A fixed-scale type cannot be changed through the table editor after the
table contains data.
- Display precision, allowed increments, minimums and maximums are business
validation concerns; `decimal(p,s)` is not a substitute for them.
Existing fixed-scale columns remain supported. The opt-in changes discovery,
not storage compatibility.