On 2009-08-19, Alban Hertroys <dalroi@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote: > On 19 Aug 2009, at 19:20, Karsten Hilbert wrote: > >> Alban, >> >> I think having an installable schema for units of measure with >> definitions and functions would be a great addition to PostgreSQL. > > Karsten, > > Thanks for the praise and the links. > >> I for one know we would use it in GNUmed (wiki.gnumed.de). >> >> A few points: >> >> Would these guys be of use as a source for reference data ? >> >> http://unitsofmeasure.org/ > > That looks certainly interesting, especially the fact that they > provide a source of units and conversions in an XML format. Although > their conversion formulas don't look all that easy to parse. > > I've run into a few of the problems they mention already; for example > the slight differences between imperial and US units of measurement > with the same names and abbreviations... > >> You may want to think about whether there's use in combining >> units with tagged types: >> >> http://svana.org/kleptog/pgsql/taggedtypes.html > > Yes, I've been thinking the same thing. I had it bookmarked already > for the very purpose of checking it out and see how I could use tagged > types with units. > >> There's also a Debian package which comes with a text format >> units database: >> >> http://packages.debian.org/source/sid/units >> >> The original source for that: >> >> This package was put together by me, James Troup <james@xxxxxxxxxx>, >> from the GNU sources, which I obtained from >> sunsite.doc.ic.ac.uk:/pub/gnu/units-1.54.tar.gz. > > I don't consider that tool very reliable[1]. A number of their > concepts are probably usable though. I have it's source in my source > tree (FreeBSD), so ample opportunity to peek. the licence is GPL2 though so that may restrict it's use in some contexts. > [1] It doesn't correctly convert °C to °F or vv, that was one of the > first things I tried. what is "vv" for °C to °F RTFM: units 'tempC(37)' 'tempF' it handles units (and arbitrary derived units) that are linked by a ratio It does that very well. units "mi water/kWh" "mm hg/btu" Offset units like centigrade and farenheit pose a problem in many contexts. if the temperature just dropped 9 °F what's that in °C ? yet the answer can be coerced from units. units 'tempF(0)-tempF(9)+tempC(0)' 'tempC' -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general