diff --git a/sql/ast.go b/sql/ast.go index 556ca62f..24c20aa3 100644 --- a/sql/ast.go +++ b/sql/ast.go @@ -455,9 +455,10 @@ func (this Thing) MarshalText() (data []byte, err error) { func NewThing(TB string, ID interface{}) *Thing { if str, ok := ID.(string); ok { - if cnv, err := strconv.ParseInt(str, 10, 64); err == nil { - return &Thing{TB: TB, ID: cnv} - } else if cnv, err := strconv.ParseFloat(str, 64); err == nil { + if cnv, err := strconv.ParseFloat(str, 64); err == nil { + if cnv == float64(int64(cnv)) { + return &Thing{TB: TB, ID: int64(cnv)} + } return &Thing{TB: TB, ID: cnv} } else if cnv, err := time.Parse(RFCDate, str); err == nil { return &Thing{TB: TB, ID: cnv.UTC()}