Skip site navigation (1) Skip section navigation (2)

Re: Money type not gone?

From: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,pgsql-bugs(at)postgresql(dot)org
Subject: Re: Money type not gone?
Date: 2004-09-21 18:29:56
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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 to establish.  

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


In response to

pgsql-bugs by date

Next:From: PostgreSQL Bugs ListDate: 2004-09-21 20:26:40
Subject: BUG #1261: CREATE DATABASE OWNER not propagating to child objects?
Previous:From: Josh BerkusDate: 2004-09-21 17:42:49
Subject: Re: Money type not gone?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group