Re: Money type not gone? - Mailing list pgsql-bugs

From Andreas Pflug
Subject Re: Money type not gone?
Date
Msg-id 41507324.3080907@pse-consulting.de
Whole thread Raw
In response to Re: Money type not gone?  (Josh Berkus <josh@agliodbs.com>)
List pgsql-bugs
Josh Berkus wrote:
>
> The difference with currency would be the lack of a fixed conversion for
> different units.    For example, you can:

You're mixing up quite a lot of stuff here.

> 10m == 1000cm

This is just what I considered forbidden to be included in that "unit-ed
type" in my previous mail. c = centi is a scale, which is up to a view
conversion, and should not be stored. It would be a pain to calculate
with it.


> 7l == 0.07m^3

l is not a SI unit, m^3 is. See below for further handling

> But you can't reasonably:
>
> 10USD == 6.25UKL

Yes, right. USD and UKL are different units, and units are generally not
convertible. If you want one from the other, you always have to multiply
it by something that adapts the units. 1kg = .001m^3 is never true, it
needs 1000kg/m^3 as factor for water. Unfortunately, for currencies this
isn't fixed (it isn't fixed for water either).

l is an abbrevation for .001m^3. If you'd really decide to handle it as
unit in the "unit-ed type", it wouldn't be convertible either. Since in
real life l and m^3 are rarely used interchanged on a specific item,
this seems acceptable.


> ... because that would require a query to money.yahoo.com to establish.

It's even more complicated. In practice, real time rates of exchanges
are much less frequent than point in time rates.

Regards,
Andreas

pgsql-bugs by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Money type not gone?
Next
From: "PostgreSQL Bugs List"
Date:
Subject: BUG #1261: CREATE DATABASE OWNER not propagating to child objects?