postgresql-unit
postgresql-unit copied to clipboard
Option to set default output unit for an angle
Thank you for your unique repo.
Problem:
In my app I need to output degree for any given angle as this is what users understand. It is hard to do this using something like
SELECT '2 deg'::unit @@ 'deg'
As some clients have direct db access and they are maybe not aware that the default is Radian. Thus i could get semantic errors.
Proposal:
similar to unit.time_output_custom
or unit.byte_output_iec
could you provide an option:
unit.angle_output_degree
?
Cheers, Claus
The idea is a good one, but the problem here is that angles are dimensionless. The module can't know if a plain number is a plain number, or an angle (or steradians). The original input unit isn't stored anywhere.
So we'd need an option "format all numbers as angles" which I'm not sure if it makes sense.