I have a simple float column, that doesn't yield the correct value when selected via a CASE
:
SELECT my_column FROM my_table LIMIT 1;
yields 815.35
But SELECT (CASE WHEN true THEN my_column ELSE 0 END) AS my_column FROM my_table LIMIT 1;
yields 815.3499755859375
Problem is obviously coming from the case and from the ELSE value (using 'test' rather than 0 works as intended, but using an other float does not)
I could solve it by using ROUND(my_column,2)
, or using a decimal column instead of a float one, but I'd actually want to understand what's happening here