-
Notifications
You must be signed in to change notification settings - Fork 559
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
TimeZone problems #604
Comments
Nothing is wrong here. |
Regardless what server time zone is and
-- server: UTC; client: Asia/Chongqing
select toDateTime(1616633456),
toDateTime(1616633456, 'Etc/UTC'),
toDateTime(1616633456, 'America/Los_Angeles'),
toDateTime(1616633456, 'Asia/Chongqing'),
toDateTime(1616633456, 'Europe/Berlin'),
toUInt32(toDateTime('2021-03-25 08:50:56')), -- 1616662256
toUInt32(toDateTime('2021-03-25 08:50:56', 'Asia/Chongqing')) |
So you are going to break the current behavior? I guess thousands of users will be shocked. |
Not all of a sudden, of course :D In 0.3.x, we can introduce another connection setting to enable the changed behavior(disabled by default). Flip in 0.4, and retire the connection setting and old behavior in 1.0. Let me know if you have better idea to reduce the impact. |
Which method does DBeaver use? Where do you see a bug? |
As I recalled, it's just a thin wrapper in DBeaver for ClickHouse, so I guess it uses TZ='Asia/Shanghai' clickhouse-client --use_client_time_zone true
...
ch-server :) select toDateTime(1616633456), toDateTime(1616633456, 'Etc/UTC'), toDateTime(1616633456, 'America/Los_Angeles'), toDateTime(1616633456, 'Asia/Chongqing'), toDateTime(1616633456, 'Europe/Berlin'), toUInt32(toDateTime('2021-03-25 08:50:56')), toUInt32(toDateTime('2021-03-25 08:50:56', 'Asia/Chongqing'))
SELECT
toDateTime(1616633456),
toDateTime(1616633456, 'Etc/UTC'),
toDateTime(1616633456, 'America/Los_Angeles'),
toDateTime(1616633456, 'Asia/Chongqing'),
toDateTime(1616633456, 'Europe/Berlin'),
toUInt32(toDateTime('2021-03-25 08:50:56')),
toUInt32(toDateTime('2021-03-25 08:50:56', 'Asia/Chongqing'))
Query id: 4a6eede6-9dfa-4dcc-92fc-3ee5f3dae8d9
┌─toDateTime(1616633456)─┬─toDateTime(1616633456, 'Etc/UTC')─┬─toDateTime(1616633456, 'America/Los_Angeles')─┬─toDateTime(1616633456, 'Asia/Chongqing')─┬─toDateTime(1616633456, 'Europe/Berlin')─┬─toUInt32(toDateTime('2021-03-25 08:50:56'))─┬─toUInt32(toDateTime('2021-03-25 08:50:56', 'Asia/Chongqing'))─┐
│ 2021-03-25 08:50:56 │ 2021-03-25 00:50:56 │ 2021-03-24 17:50:56 │ 2021-03-25 08:50:56 │ 2021-03-25 01:50:56 │ 1616662256 │ 1616633456 │
└────────────────────────┴───────────────────────────────────┴───────────────────────────────────────────────┴──────────────────────────────────────────┴─────────────────────────────────────────┴─────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┘
1 rows in set. Elapsed: 0.038 sec. On DBeaver(with default settings, local timezone is Asia/Shanghai), same query gives you below:
|
@enqueue, my memory didn't serve me well. After taking a closer look at DBeaver code, I think it we probably don't need to change anything in the driver. I'll download the code and submit a PR to fix this. |
Now the new JDBC driver
|
The code I run in DBeaver (via JDBC) and the result (wrong, timezone left +3 hours)
The same code that I run in Tabix and the result (correct, timezone left +0 hours)
What is it?
The text was updated successfully, but these errors were encountered: