postgresql-unit icon indicating copy to clipboard operation
postgresql-unit copied to clipboard

Option to set default output unit for an angle

Open clausMeko opened this issue 2 years ago • 1 comments

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

clausMeko avatar Apr 01 '22 13:04 clausMeko

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.

df7cb avatar Apr 02 '22 18:04 df7cb