Search Postgresql Archives

Re: Extended unit

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

 



... none of which require any extensions to the core type system.

AFAICS this could easily be implemented as a user-defined type, along
the lines of

	CREATE TYPE measurement AS (value double, units text);

and if you want to constrain a particular column to contain only one
value of units, use CHECK.

The argument that we should extend the type system for this would become
a lot more credible if there were a widely-used extension in existence
for it to prove that there's sufficient demand.
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.


Cordialement,
Jean-Gérard Pailloncy


---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match


[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