Files
komp_ac/docs/fixed-scale-decimal.md
2026-08-24 19:58:44 +02:00

1.2 KiB

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.