Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parsing time "0000-00-00 13:14:15": month out of range #1199

Closed
travelliu opened this issue Mar 11, 2021 · 1 comment
Closed

parsing time "0000-00-00 13:14:15": month out of range #1199

travelliu opened this issue Mar 11, 2021 · 1 comment

Comments

@travelliu
Copy link

Issue description

Is it possible to return the wrong time as a string?

0000-00-00 13:14:15 --> scan into string not return parsing time "0000-00-00 13:14:15": month out of range

Example code

select * from test_date limit 20;
+---------------------+
| date1               |
+---------------------+
| 2021-03-08 00:00:00 |
| 2021-03-08 00:00:00 |
| 2021-03-08 00:00:00 |
| 2021-03-08 00:00:00 |
| 2021-03-08 00:00:00 |
| 2021-03-08 00:00:00 |
| 2021-03-08 00:00:00 |
| 2021-03-09 11:02:59 |
| 2021-03-09 11:03:00 |
| 2021-03-09 11:03:02 |
| 2021-03-09 11:03:03 |
| 2021-03-09 11:03:05 |
| 0000-00-00 13:14:15 |
| 2021-03-08 00:00:00 |
| 2021-03-08 00:00:00 |
| 2021-03-08 00:00:00 |
| 2021-03-08 00:00:00 |
| 2021-03-08 00:00:00 |
| 2021-03-08 00:00:00 |
| 2021-03-08 00:00:00 |
+---------------------+
rows, err := db.Query("select date1 from mtk1.test_date")
if err != nil {
    t.Error(err)

}
for rows.Next() {
    var b string
    if err := rows.Scan(&b); err != nil {
        fmt.Print(err)
    }
    fmt.Println("aaa", b)
}
if rows.Err() != nil {
    fmt.Println(rows.Err())
}

Error log

aaa 2021-03-08T00:00:00Z
aaa 2021-03-08T00:00:00Z
aaa 2021-03-08T00:00:00Z
aaa 2021-03-08T00:00:00Z
aaa 2021-03-08T00:00:00Z
aaa 2021-03-08T00:00:00Z
aaa 2021-03-08T00:00:00Z
aaa 2021-03-09T11:02:59Z
aaa 2021-03-09T11:03:00Z
aaa 2021-03-09T11:03:02Z
aaa 2021-03-09T11:03:03Z
aaa 2021-03-09T11:03:05Z
parsing time "0000-00-00 13:14:15": month out of range -->

Configuration

Driver version (or git SHA): v1.5.0

Go version: go version go1.15.2 darwin/amd64

Server version: 5.7.32-log

Server OS: MacOS 11.2

@methane
Copy link
Member

methane commented Mar 11, 2021

Do you use parseTime=true option? If so, disable it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants