So if your only dealing with US currency, why not love the money type?
So if your only dealing with US currency, why not love the money type?
http://www.postgresql.org/message-id/b42b73150805270629h309f...
I use it a lot, and yes, it is missing some casts but you can cast to decimal and go from there:
select '42.00'::money::decimal;
I've also used stripe, and maybe it's a javascript thing, but they represent all their money in cents. Personally, I'd rather use the money type, it is easy for me to reason about.
For a "datatype" as commonly needed as "money", it has always struck me as strange that a more standardized and widely agreed upon approach to dealing with them, have not emerged.
As the currency of money is not known it is pretty obvious that one needs to store that in another column.