Re: Extended unit - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Extended unit
Date
Msg-id 20050126103454.GC23796@svana.org
Whole thread Raw
In response to Re: Extended unit  (Richard Huxton <dev@archonet.com>)
Responses Re: Extended unit
Re: Extended unit
List 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@svana.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.

Attachment

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Extended unit
Next
From: Eric Brown
Date:
Subject: log_min_duration_statement