Search Postgresql Archives

Re: Extended unit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 25, 2005 at 11:41:28PM +0100, Pailloncy Jean-Gerard wrote:
> I have begining to put all the SI unit in a table.
> I am writing the function to check the unit in a standard way.
> I plan to use the user-defined type proposed by Tom Lane.
> The check are done at execution time.
> 
> But I object that what I am doing is just a proof of concept and not 
> the right thing to do.
> 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.

Actually, there's no reason to store a string there. Just like for
timezones, I was proposing having a table listing all the timezones
postgresql knows about and using the oid of that row as the timezone
identifier. This only requires four bytes per field, not unreasonable.

So, you have 1=Amps, 2=Volts, 3=Ohms, etc... It's a little more
querying but if you wrote the functions in C I think you could get it
all fairly performant.

Now, how to store the relationships between them to handle
multiplication and division. Probably go back to base types...

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog@xxxxxxxxx>   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: pgpKH0UtIVurP.pgp
Description: PGP signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux