-
-
Notifications
You must be signed in to change notification settings - Fork 935
Closed
Labels
Description
When inserting a number with higher precision than 6 decimal places (for example, longitude of 35.03554004971999) the precision past the 6th place is lost. The field type is float64 and has a data type in Postgres as numeric.
Example:
package main
import (
"database/sql"
"fmt"
_ "github.com/lib/pq"
)
func main() {
db, _ := sql.Open("postgres", "user=gorm dbname=gorm sslmode=disable")
sql := `INSERT INTO users (latitude) VALUES ($1) RETURNING "id"`
res, err := db.Exec(sql, 35.03554004971999)
fmt.Println(res, err)
}