-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
type/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
- What did you do?
If possible, provide a recipe for reproducing the error.
package main
import (
"database/sql"
"fmt"
"log"
_ "github.com/go-sql-driver/mysql"
)
func main() {
db, err := sql.Open("mysql", "root@tcp(127.0.0.1:4000)/test")
if err != nil {
log.Fatal(err)
}
defer db.Close()
db.Exec("CREATE TABLE IF NOT Exists `t1` (`id` bigint(20) UNSIGNED NOT NULL, PRIMARY KEY (`id`) )")
db.Exec("insert into t1 values (18446744073709551615)")
var i = ^uint64(0)
rows, err := db.Query("select id from t1 where id=?", i)
if err != nil {
log.Fatal(err)
}
defer rows.Close()
var r uint64
for rows.Next() {
rows.Scan(&r)
fmt.Printf("GOT: %d \n", r)
}
rows, err = db.Query("select id from t1 where id=?", -1)
if err != nil {
log.Fatal(err)
}
defer rows.Close()
for rows.Next() {
rows.Scan(&r)
fmt.Printf("GOT: %d \n", r)
}
}
- What did you expect to see?
run against MySQL it returns
GOT: 18446744073709551615
- What did you see instead?
run against TiDB it returns:
GOT: 18446744073709551615
GOT: 18446744073709551615
- What version of TiDB are you using (
tidb-server -V
or runselect tidb_version();
on TiDB)?
Release Version: v3.0.0-beta.1-68-ge48b258f9
Git Commit Hash: e48b258f9226ed8d4e6147154afb26ab7d8c59b2
Git Branch: master
UTC Build Time: 2019-04-04 05:05:01
GoVersion: go version go1.12.1 darwin/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
related issue: go-sql-driver/mysql#838
Metadata
Metadata
Assignees
Labels
type/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.