Re: monetary bug - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: monetary bug
Date
Msg-id 200408222234.07650.peter_e@gmx.net
Whole thread Raw
In response to Re: monetary bug  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: monetary bug
List pgsql-hackers
Tom Lane wrote:
> The idea behind the money type is to format per the lc_monetary
> locale setting, which seems perfectly reasonable to me.

To me, this seems completely wrong-headed.  Data types should be defined 
by what operations you can do on them, not by what output format they 
have.  With that in mind, a money type that is separate from numeric 
types could be reasonable, because not all mathematical operations are 
reasonable on monetary amounts.  But most well-designed client 
interfaces nowadays reparse the text representations of data to present 
the datum in terms of the client's own data type system, so a money 
type with a varying and unpredictable output format cannot be 
reasonably supported and will only create headaches.  And even those 
client interfaces that don't fall into that category will have trouble, 
because for example you could have trouble sorting the values 
numerically.  So again, if you're looking for a certain display form, 
use the functions that were made for that purpose.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: monetary bug
Next
From: "D'Arcy J.M. Cain"
Date:
Subject: Re: monetary bug