--- definitions.units	2023-01-04 18:22:06.602713513 +0200
+++ definitions.units.patched	2023-01-04 19:54:54.681679346 +0200
@@ -230,7 +230,7 @@
                  # equator to a pole.
 
 h_SI      6.62607015e-34
-h         6.62607015e-34 J s # Planck constant (exact)
+h         6.62607015e-34 (m^2*kg/s^2) s # Planck constant (exact)
 
 kg        !      # The kilogram, symbol kg, is the SI unit of mass.  It is
 kilogram  kg     # defined by taking the fixed numerical value of the Planck
@@ -279,7 +279,7 @@
                  # https://en.wikipedia.org/wiki/Kibble_balance
 
 k_SI      1.380649e-23
-boltzmann 1.380649e-23 J/K   # Boltzmann constant (exact)
+boltzmann 1.380649e-23 (m^2*kg/s^2)/K   # Boltzmann constant (exact)
 k         boltzmann
 
 K         !      # The kelvin, symbol K, is the SI unit of thermodynamic
@@ -322,7 +322,7 @@
                  # depend directly on temperature.
 
 e_SI      1.602176634e-19
-e         1.602176634e-19 C  # electron charge (exact)
+e         1.602176634e-19 A s  # electron charge (exact)
 
 A         !      # The ampere, symbol A, is the SI unit of electric current.
 ampere    A      # It is defined by taking the fixed numerical value of the
@@ -425,7 +425,9 @@
 # A primitive non-SI unit
 #
 
-bit       !      # Basic unit of information (entropy).  The entropy in bits
+B         !
+byte      B
+bit       1|8 B  # Basic unit of information (entropy).  The entropy in bits
                  #   of a random variable over a finite alphabet is defined
                  #   to be the sum of -p(i)*log2(p(i)) over the alphabet where
                  #   p(i) is the probability that the random variable takes
@@ -442,6 +444,8 @@
 #                                                                         #
 ###########################################################################
 
+quetta-                 1e30
+ronna-                  1e27
 yotta-                  1e24     # Greek or Latin octo, "eight"
 zetta-                  1e21     # Latin septem, "seven"
 exa-                    1e18     # Greek hex, "six"
@@ -464,6 +468,8 @@
 atto-                   1e-18    # Danish-Norwegian atten, "eighteen"
 zepto-                  1e-21    # Latin septem, "seven"
 yocto-                  1e-24    # Greek or Latin octo, "eight"
+ronto-                  1e-27
+quecto-                 1e-30
 
 quarter-                1|4
 semi-                   0.5
@@ -482,6 +488,8 @@
 exbi-                   2^60
 zebi-                   2^70     # Zebi- and yobi- were added in the 2005 ed.,
 yobi-                   2^80     # later superseded by ISO/IEC 80000-13:2008.
+robi-                   2^90
+quebi-                  2^100
 Ki-                     kibi
 Mi-                     mebi
 Gi-                     gibi
@@ -490,7 +498,11 @@
 Ei-                     exbi
 Zi-                     zebi
 Yi-                     yobi
+Ri-                     robi
+Qi-                     quebi
 
+Q-                      quetta
+R-                      ronna
 Y-                      yotta
 Z-                      zetta
 E-                      exa
@@ -505,12 +517,15 @@
 c-                      centi
 m-                      milli
 u-                      micro   # it should be a mu but u is easy to type
+mu-                     micro
 n-                      nano
 p-                      pico
 f-                      femto
 a-                      atto
 z-                      zepto
 y-                      yocto
+r-                      ronto
+q-                      quecto
 
 #
 # Names of some numbers
@@ -683,6 +698,14 @@
 padm                    1e15
 shankh                  1e17
 
+# postgresql-unit: Define some units before they are used elsewhere before their original definition
+pi                      3.14159265358979323846
+π                       pi
+astronomicalunit        149597870700 m # IAU definition from 2012, exact
+au                      astronomicalunit # ephemeris for the above described
+m2                      m^2
+
+
 #############################################################################
 #                                                                           #
 # Derived units which can be reduced to the primitive units                 #
@@ -962,7 +985,7 @@
 pointangle              1|32 circle  # Used for reporting compass readings
 centrad                 0.01 radian  # Used for angular deviation of light
                                      # through a prism.
-mas                     milli arcsec # Used by astronomers
+mas                     milliarcsec  # Used by astronomers
 seclongitude            circle (seconds/day) # Astronomers measure longitude
                                      # (which they call right ascension) in
                                      # time units by dividing the equator into
@@ -1083,8 +1106,8 @@
 tempF(x) units=[1;K] domain=[-459.67,) range=[0,) \
                 (x+(-32)) degF + stdtemp ; (tempF+(-stdtemp))/degF + 32
 tempfahrenheit() tempF
-degfahrenheit           5|9 degC
-degF                    5|9 degC
+degfahrenheit           5|9 * degC
+degF                    5|9 * degC
 
 
 degreesrankine          degF              # The Rankine scale has the
@@ -1096,7 +1119,7 @@
 
 tempreaumur(x)    units=[1;K] domain=[-218.52,) range=[0,) \
                   x degreaumur+stdtemp ; (tempreaumur+(-stdtemp))/degreaumur
-degreaumur              10|8 degC # The Reaumur scale was used in Europe and
+degreaumur              10|8 * degC # The Reaumur scale was used in Europe and
                                   # particularly in France.  It is defined
                                   # to be 0 at the freezing point of water
                                   # and 80 at the boiling point.  Reaumur
@@ -1184,7 +1207,7 @@
 
 # Basic constants
 
-pi                      3.14159265358979323846
+#pi                      3.14159265358979323846
 tau                     2 pi
 phi                     (sqrt(5)+1)/2
 light                   c
@@ -1341,6 +1364,15 @@
 H2O50C        0.98807 force gram / cm^3
 H2O100C       0.95838 force gram / cm^3
 
+# moved because ft is used before being defined (and otherwise parsed as femtotonne)
+inch                    2.54 cm
+in                      inch
+inches                  inch
+foot                    12 inch
+feet                    foot
+ft                      foot
+ft3                     ft^3
+
 # Atomic constants
 
 hartree            4.3597447222071e-18 J # Approximate electric potential energy
@@ -1715,7 +1747,7 @@
 
 abampere                10 A            # Current which produces a force of
 abamp                   abampere        #   2 dyne/cm between two infinitely
-aA                      abampere        #   long wires that are 1 cm apart
+#aA                     abampere        #   long wires that are 1 cm apart
 abA                     abampere
 biot                    abampere
 Bi                      biot
@@ -2668,8 +2700,8 @@
                                         # gravitational constant. This is a
                                         # fictional year, and doesn't
                                         # correspond to any celestial event.
-astronomicalunit         149597870700 m # IAU definition from 2012, exact
-au                     astronomicalunit # ephemeris for the above described
+#astronomicalunit         149597870700 m # IAU definition from 2012, exact
+#au                     astronomicalunit # ephemeris for the above described
                                         # astronomical unit.  (See the NASA
                                         # site listed above.)
 GMsun    132712440041.279419 km^3 / s^2 # heliocentric gravitational constant
@@ -3003,11 +3035,6 @@
 int                     3937|1200 ft/m   # Convert US Survey measures to
 int-                    int              #   international measures
 
-inch                    2.54 cm
-in                      inch
-foot                    12 inch
-feet                    foot
-ft                      foot
 yard                    3 ft
 yd                      yard
 mile                    5280 ft          # The mile was enlarged from 5000 ft
@@ -3155,6 +3182,7 @@
 # Liquid measure
 
 usgallon                231 in^3        # US liquid measure is derived from
+gallon                  usgallon
 gal                     gallon          # the British wine gallon of 1707.
 quart                   1|4 gallon      # See the "winegallon" entry below
 pint                    1|2 quart       # more historical information.
@@ -3656,7 +3684,7 @@
 
 number1can              10 usfloz
 number2can              19 usfloz
-number2.5can            3.5 uscups
+number2_5can            3.5 uscups
 number3can              4 uscups
 number5can              7 uscups
 number10can             105 usfloz
@@ -4618,10 +4646,10 @@
 
 btu                     btu_IT       # International Table BTU is the default
 britishthermalunit      btu
-btu_IT                  cal_IT lb degF / gram K
-btu_th                  cal_th lb degF / gram K
-btu_mean                cal_mean lb degF / gram K
-btu_15                  cal_15 lb degF / gram K
+btu_IT                  cal_IT lb (degF) / gram K
+btu_th                  cal_th lb (degF) / gram K
+btu_mean                cal_mean lb (degF) / gram K
+btu_15                  cal_15 lb (degF) / gram K
 btu_ISO                 1055.06 J    # Exact, rounded ISO definition based
                                      #    on the IT calorie
 quad                    quadrillion btu
@@ -4784,7 +4812,7 @@
 
 # Celsius heat unit: energy to raise a pound of water 1 degC
 
-celsiusheatunit         cal lb degC / gram K
+celsiusheatunit         cal lb (degC) / gram K
 chu                     celsiusheatunit
 
 # "Apparent" average power in an AC circuit, the product of rms voltage
@@ -4842,13 +4870,13 @@
 Uvalue                  1/Rvalue
 europeanUvalue          watt / m^2 K
 RSI                     degC m^2 / W
-clo                     0.155 degC m^2 / W # Supposed to be the insulance
+clo                     0.155 * degC m^2 / W # Supposed to be the insulance
                                            # required to keep a resting person
                                            # comfortable indoors.  The value
                                            # given is from NIST and the CRC,
                                            # but [5] gives a slightly different
                                            # value of 0.875 ft^2 degF hr / btu.
-tog                     0.1 degC m^2 / W   # Also used for clothing.
+tog                     0.1 * degC m^2 / W   # Also used for clothing.
 
 
 # Thermal Conductivity of a few materials
@@ -5352,8 +5380,8 @@
                                              #   to symbols per second.  Modern
                                              #   modems transmit several bits
                                              #   per symbol.
-byte                    8 bit                # Not all machines had 8 bit
-B                       byte                 #   bytes, but these days most of
+#byte                    8 bit               # Not all machines had 8 bit
+#B                       byte                #   bytes, but these days most of
                                              #   them do.  But beware: for
                                              #   transmission over modems, a
                                              #   few extra bits are used so
@@ -6800,7 +6828,7 @@
 
 pa                      Pa
 ev                      eV
-hg                      Hg
+#hg                     Hg
 oe                      Oe
 mh                      mH
 rd                      rod
@@ -7182,7 +7210,8 @@
 Mag                     Maz gravity        # force
 Maz                     Volm kg / oldliter # mass based on water
 
-Tm                      Tim                # Abbreviations
+#gross conflict with terameter
+#Tm                      Tim                # Abbreviations
 Gf                      Grafut
 Sf                      Surf
 Vm                      Volm
@@ -7972,7 +8001,7 @@
 ton                     uston
 scruple                 apscruple
 fluidounce              usfluidounce
-gallon                  usgallon
+#gallon                  usgallon
 bushel                  usbushel
 quarter                 quarterweight
 cup                     uscup
