Skip to content

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

Closed
@travelliu

Description

@travelliu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions