| From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
|---|---|
| To: | Greg Stark <gsstark(at)mit(dot)edu> |
| Cc: | Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>, Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>, pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Re: Unit conversion database (was: multiple paramters in aggregate function) |
| Date: | 2009-08-19 19:49:32 |
| Message-ID: | 20090819194931.GH4894@alvh.no-ip.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Greg Stark wrote:
> On Wed, Aug 19, 2009 at 8:24 PM, Alvaro
> Herrera<alvherre(at)commandprompt(dot)com> wrote:
> >> [1] It doesn't correctly convert °C to °F or vv, that was one of the
> >> first things I tried.
> >
> > Seems it's easy to misuse it. You need tempF(x) and tempC notation for
> > converting absolute temperature differences:
> >
> > You have: tempF(212)
> > You want: tempC
> > 100
>
> That depends on whether you're converting a temperature or a
> temperature difference. If you want to know what a 100 degree C drop
> in temperature equates to in Fahrenheit the answer is not 212 but
> rather 180.
Right -- and there's a different interface for that.
You have: 100 degC
You want: degF
* 180
/ 0.0055555556
> I think it would be useful to have a builtin data type which contained
> a float and an opaque text unit. It could support linear operations
> like +, -, and sum() by just throwing an error if the units didn't
> match.
This sounds very much like Martijn's tagged types.
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sanjay Arora | 2009-08-19 20:22:04 | Stock Market Price Data & postgreSQL? HELLPPP Please |
| Previous Message | Greg Stark | 2009-08-19 19:40:58 | Re: Unit conversion database (was: multiple paramters in aggregate function) |