You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then, I insert one record using golang like the following:
sql := "insert into test.dt(event_id, timestamp) values(?, ?)"
//2201-04-15 19:58:20
tt := time.Date(2201, 04, 15, 19, 58, 20, 0, time.UTC)
tx, err := conn.Begin()
if err != nil {
return
}
_, err = tx.Exec(sql, 1, tt)
if err != nil {
return
}
if err = tx.Commit(); err != nil {
assert.Nil(t, err)
}
However, I get the following result:
SELECT *
FROM test.dt
┌───────────timestamp─┬─event_id─┐
│ 2065-03-08 13:30:04 │ 1 │
└──────────────── ┴────── ┘
My question is why 2201-04-15 19:58:20 is converted to 2065-03-08 13:30:04 in this situation.
And how 2201-04-15 19:58:20 is converted to 2065-03-08 13:30:04 in this situation.
Thanks!
The text was updated successfully, but these errors were encountered:
@den-crane Thanks very much for your response. However I still can't get your point. Can you give more details? When the Int32 overflow happens? How the Int32 overflow Happens? Can you give some source code to explain this?
BackGround:
CREATE TABLE test.dt
(
timestamp
DateTime,event_id
UInt8)
ENGINE = TinyLog
Supported range of values: [1970-01-01 00:00:00, 2105-12-31 23:59:59].
https://clickhouse.tech/docs/en/data_types/datetime/
Then, I insert one record using golang like the following:
sql := "insert into test.dt(event_id, timestamp) values(?, ?)"
//2201-04-15 19:58:20
tt := time.Date(2201, 04, 15, 19, 58, 20, 0, time.UTC)
tx, err := conn.Begin()
if err != nil {
return
}
_, err = tx.Exec(sql, 1, tt)
if err != nil {
return
}
if err = tx.Commit(); err != nil {
assert.Nil(t, err)
}
However, I get the following result:
SELECT *
FROM test.dt
┌───────────timestamp─┬─event_id─┐
│ 2065-03-08 13:30:04 │ 1 │
└──────────────── ┴────── ┘
My question is why 2201-04-15 19:58:20 is converted to 2065-03-08 13:30:04 in this situation.
And how 2201-04-15 19:58:20 is converted to 2065-03-08 13:30:04 in this situation.
Thanks!
The text was updated successfully, but these errors were encountered: