Skip to content

Instantly share code, notes, and snippets.

@alexey-milovidov
Created February 22, 2021 17:46
Show Gist options
  • Save alexey-milovidov/0142655656fa90ade77a746615c90041 to your computer and use it in GitHub Desktop.
Save alexey-milovidov/0142655656fa90ade77a746615c90041 to your computer and use it in GitHub Desktop.
$ clickhouse-client
ClickHouse client version 21.3.1.1.
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 21.3.1 revision 54447.
milovidov-desktop :) SELECT toDateTime(1234567890, 'Europe/Moscow')
SELECT toDateTime(1234567890, 'Europe/Moscow')
Query id: 99607776-8d7a-47f7-a3ca-ed00baa20c08
┌─toDateTime(1234567890, 'Europe/Moscow')─┐
│ 2009-02-14 02:31:30 │
└─────────────────────────────────────────┘
1 rows in set. Elapsed: 0.003 sec.
milovidov-desktop :) SELECT toDateTime(1234567890, 3)
SELECT toDateTime(1234567890, 3)
Query id: aa5c240b-4720-4a5f-af1f-b4f7055c1e4a
┌─toDateTime(1234567890, 3)─┐
│ 2009-02-14 02:31:30.000 │
└───────────────────────────┘
1 rows in set. Elapsed: 0.002 sec.
milovidov-desktop :) SELECT toDateTime(1234567890, 3, 'Europe/Moscow')
SELECT toDateTime(1234567890, 3, 'Europe/Moscow')
Query id: a51dc2f5-8068-4bb8-92f7-9035707f02a3
┌─toDateTime(1234567890, 3, 'Europe/Moscow')─┐
│ 2009-02-14 02:31:30.000 │
└────────────────────────────────────────────┘
1 rows in set. Elapsed: 0.002 sec.
milovidov-desktop :) SELECT toDateTime(1234567890, 'Europe/Moscow', 3)
SELECT toDateTime(1234567890, 'Europe/Moscow', 3)
Query id: a271d4cb-af4f-442a-8e5a-b0165455bab1
0 rows in set. Elapsed: 0.017 sec.
Received exception from server (version 21.3.1):
Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Illegal type of argument #2 'scale' of function toDateTime, expected const Integer, got String: While processing toDateTime(1234567890, 'Europe/Moscow', 3).
milovidov-desktop :) SELECT toDateTime(1234567890.0, 3, 'Europe/Moscow')
SELECT toDateTime(1234567890., 3, 'Europe/Moscow')
Query id: 5b1d5a09-d3c3-48ef-b1fe-3163b73455d2
0 rows in set. Elapsed: 0.011 sec.
Received exception from server (version 21.3.1):
Code: 44. DB::Exception: Received from localhost:9000. DB::Exception: Illegal column String of time zone argument of function, must be constant string: While processing toDateTime(1234567890., 3, 'Europe/Moscow').
milovidov-desktop :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment