MONEY (fixed-point currency type)
Last updated: 2026-11-04
MONEY (fixed-point currency type)
MONEY is PostgreSQL's historical currency type. Internally it keeps the amount in a 64-bit integer scaled by 100, so it always carries exactly two decimal places. Its output format depends on lc_monetary and includes a currency symbol and thousands separators, which makes the rendering differ across locales. Its operator set is limited too: it combines only with money itself for addition and subtraction, and with integers for multiplication and division only. MONEY suits legacy systems with a single currency and fixed two-decimal amounts, but multi-currency or variable-precision scenarios are better served by NUMERIC plus a separate currency column.
| Kind | type |
|---|---|
| Example Language | SQL |
📝 Syntax
MONEY —— fixed-point currency type, always two decimals, output depends on lc_monetary
Returns:Stores an amount as a 64-bit integer in hundredths of the currency unit. Output is formatted according to lc_monetary as a signed amount string, and adding it directly to numeric raises "operator does not exist: money + numeric".
▶ Example
Runs real PostgreSQL 18 right in your browser (PGlite WASM, nothing to install). Press ▶ Run and the result appears in the panel below.
Output:
id | price | as_numeric | col_type
----+-----------+------------+----------
1 | $1,234.56 | 1234.56 | money
2 | $0.99 | 0.99 | money
📌 Key Points
- MONEY is an integer scaled by 100 internally, so there is no floating-point error, which is its core advantage over DOUBLE PRECISION.
- Output depends on lc_monetary: the same value may render as $1,234.56, 1.234,56 or something else depending on the locale. In automated tests, cast with ::numeric and assert on the number.
- The operator set is narrow: money + money, money - money and money / money work, money * money does not, and against integers only multiplication and division are defined — money + integer simply raises an error.
- Trade-off: MONEY is convenient for legacy systems with one currency and two decimals, but multi-currency setups and currencies with zero or three decimals such as JPY and KWD require NUMERIC plus a currency column.