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.
pgpUkajdg630L.pgp
Description: PGP signature