postgresql-unit 1.0 released

postgresql-unit implements a PostgreSQL datatype for SI units, plus
byte. The base units can be combined to named and unnamed derived
units using operators defined in the PostgreSQL type system. SI
prefixes are used for input and output, and quantities can be
converted to arbitrary scale.


# CREATE extension unit;

# SELECT '800 m'::unit + '500 m' AS length;
 1.3 km

# SELECT '120 km/h'::unit AS speed;
 33.3333 m/s

# SELECT '9.81 N'::unit / 'kg' AS gravity;
 9.81 m/s^2

# SELECT '2 MB/min'::unit @ 'GB/d' AS traffic;
 2.88 GB/d

# SELECT '1 hl'::unit @ '0.5 l' AS bottles_of_beer;
 200 * 0.5 l


* SI base types: meter (m), kilogram (kg), second (s), ampere (A), kelvin (K),
  mole (mol), candela (cd)
* byte (B) is also a base type
* derived units coherent with SI: radian (rad), steradian (sr), hertz (Hz),
  newton (N), pascal (Pa), joule (J), watt (W), coulomb (C), volt (V), farad
  (F), ohm (Ω), siemens (S), weber (Wb), tesla (T), henry (H), degree Celsius
  (°C, support limited), lumen (lm), lux (lx), becquerel (Bq), gray (Gy),
  sievert (Sv), katal (kat)
* non-coherent units: minute (min), hour(h), day(d), hectare (ha), litre (l),
  tonne (t), bar, astronomical unit (au)
* prefix multiples: da, h, k, M, G, T, P, E, Z, Y
* prefix fractions: d, c, m, μ, n, p, f, a, z, y
* operators: +, -, *, /, ^, conversion to arbitrary scale (@)


The source tarball is available via GitHub:

Packages for Debian and Ubuntu are available via

Bug reports and feature requests are welcome!

Attachment: signature.asc
Description: PGP signature

Reply via email to