How can you check the scale of a decimal number? For example, suppose we want to keep ratings for a hotel with a maximum number of 2 decimal places after the decimal point. 4.34. 3.76. etc.
I read on the web that sqlite is truncated based on the accuracy / scale that you bound to the column. Therefore, if you have accuracy 3, scale 2 and enter 1.34567 1.35 will be saved.
However, I use postgres, and it is not. I enter this and the DB stores the whole thing somehow, despite my accuracy scale of 3.
t.decimal :my_column, precision: 3, scale: 2
So, how can I check for such things and why does postgres store more than 2 decimal places?
source
share