From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Pailloncy Jean-Gerard <jg(at)rilk(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Extended unit |
Date: | 2005-01-26 09:06:16 |
Message-ID: | 41F75D88.8010408@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tom Lane wrote:
> Pailloncy Jean-Gerard <jg(at)rilk(dot)com> writes:
>
>>I do not want for each column and each row to store the value and the
>>unit.
>
>
>>I do want to put the unit in the definition of the column and the check
>>on the parser before any execution.
>
>
> 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.
I was about to say this is similar to the interval type, but of course
there are issues there with month/year not being a consistent length.
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2005-01-26 09:12:56 | Re: Good PostgreSQL Based Shopping Cart Software ... ? |
Previous Message | Sim Zacks | 2005-01-26 08:59:44 | Re: Good PostgreSQL Based Shopping Cart Software ... ? |