Money
Money bugs are quiet. A rounding rule, a float, or a missing ledger entry can be wrong for months before anyone adds up the numbers. These posts cover the parts that have to be exact.
Start here
How to Store Money in a Database Without Losing Cents
Store money in a database as integer minor units plus a currency code. Why 19.99 * 100 loses a cent, why yen and dinars break 'cents', and how to split 10.00.
Double-Entry Ledger in Postgres: Enforce the Rules in the Database
Double-entry ledger design in Postgres: a deferred trigger rejects unbalanced transactions at COMMIT, and row locks in id order stop two payouts overdrawing.
Payment Reconciliation in SQL: Match Your Ledger to the Bank
Payment reconciliation in SQL: match every ledger row to the provider's report and every payout to one bank deposit, then explain what is left over.
All Money posts
Payment Reconciliation in SQL: Match Your Ledger to the Bank
Payment reconciliation in SQL: match every ledger row to the provider's report and every payout to one bank deposit, then explain what is left over.
Double-Entry Ledger in Postgres: Enforce the Rules in the Database
Double-entry ledger design in Postgres: a deferred trigger rejects unbalanced transactions at COMMIT, and row locks in id order stop two payouts overdrawing.
How to Store Money in a Database Without Losing Cents
Store money in a database as integer minor units plus a currency code. Why 19.99 * 100 loses a cent, why yen and dinars break 'cents', and how to split 10.00.