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.

Kindtype
Example LanguageSQL

📝 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

More case studies coming soon.

📚 Related Reference

❓ FAQ

QMONEY or NUMERIC for amounts?
AFor new systems prefer NUMERIC: it decouples the value from the currency symbol, gives you control over the scale, renders identically in every locale and is not hampered by MONEY's restricted operators. MONEY is mainly a convenience for migrating legacy systems.
QHow do I make MONEY output a plain number?
A::text still yields the formatted amount with a symbol; ::numeric gives the number: SELECT 1234.56::money::numeric; returns 1234.56.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

Content reviewed by MOTO · Found an error? Report it

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏