From: | Christoph Berg <cb(at)df7cb(dot)de> |
---|---|
To: | PostgreSQL Announce <pgsql-announce(at)postgresql(dot)org> |
Subject: | postgresql-unit 1.0 released |
Date: | 2016-09-22 14:25:52 |
Message-ID: | 20160922142552.agfzqhawq5zxizdh@msg.df7cb.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-announce |
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.
Examples
--------
# CREATE extension unit;
CREATE EXTENSION
# SELECT '800 m'::unit + '500 m' AS length;
length
--------
1.3 km
# SELECT '120 km/h'::unit AS speed;
speed
-------------
33.3333 m/s
# SELECT '9.81 N'::unit / 'kg' AS gravity;
gravity
------------
9.81 m/s^2
# SELECT '2 MB/min'::unit @ 'GB/d' AS traffic;
traffic
-----------
2.88 GB/d
# SELECT '1 hl'::unit @ '0.5 l' AS bottles_of_beer;
bottles_of_beer
-----------------
200 * 0.5 l
Features
--------
* 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 (@)
Download
--------
The source tarball is available via GitHub:
https://github.com/ChristophBerg/postgresql-unit
Packages for Debian and Ubuntu are available via apt.postgresql.org.
Bug reports and feature requests are welcome!
From | Date | Subject | |
---|---|---|---|
Next Message | David Fetter | 2016-09-25 20:31:16 | == PostgreSQL Weekly News - September 25 2016 == |
Previous Message | Howard Rolph | 2016-09-20 14:03:46 | CHAR(16): Call for papers deadline Sept. 30 216 |