Re: Extended unit

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pailloncy Jean-Gerard <jg(at)rilk(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Extended unit
Date: 2005-01-26 10:34:58
Message-ID: 20050126103454.GC23796@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jan 26, 2005 at 09:06:16AM +0000, Richard Huxton wrote:
> Tom Lane wrote:
> >If you do that, you foreclose the ability to store mixed values in a
> >single column, in return for what? Saving a couple of bytes per value?
> >(I suppose that in a serious implementation we'd store the units as some
> >sort of reference, not as a string.) Compare the implementation of the
> >NUMERIC type: you *can* constrain a column to have a fixed precision,
> >but you do not *have* to.
>
> It strikes me that the right level of constraint is the quantity being
> represented: length / mass / time / velocity.
>
> Then you could store any of: '1inch', '2m', '3km', '4light-years' in a
> "length" column.

Ofcourse, only one of those is in SI units :) Just like the interval
type, all this could be handled by the parser. Define some costant
conversions, after all a light-year is about 9.5e15 metres.

The question is, if you put one inch in, do you expect to get one inch
out?

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Eric Brown 2005-01-26 10:39:21 log_min_duration_statement
Previous Message Martijn van Oosterhout 2005-01-26 10:30:05 Re: Extended unit