Typesafe floats ?
I'm trying to create a column called "weight". It needs to have values like "33.33" as floats.
I'm using PostgreSQL - and I've created a column with the following settings;
numeric('weight', { precision: 10, scale: 2 })
The thing is - when I try to insert a value like 33.33
it tells me that
If the numeric is a string - how can it be typesafe, as I can insert any string I want ? I mean PSQL will throw an error, but how can I make it typesafe ?
Thank you guys3 Replies
At the moment - here's what I'm doing:
weight: (100).toFixed(2)
use float/double precision
float does not work in PSQL if I'm not mistaken.
I've used this ->
But still got the string type