mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Use time zone when comparing DateTime with string literal
This commit is contained in:
parent
2f06a7b4c1
commit
cac130ad3b
@ -849,7 +849,7 @@ private:
|
||||
{
|
||||
time_t date_time;
|
||||
ReadBufferFromMemory in(string_value.data, string_value.size);
|
||||
readDateTimeText(date_time, in);
|
||||
readDateTimeText(date_time, in, dynamic_cast<const DataTypeDateTime &>(*number_type).getTimeZone());
|
||||
if (!in.eof())
|
||||
throw Exception("String is too long for DateTime: " + string_value.toString(), ErrorCodes::TOO_LARGE_STRING_SIZE);
|
||||
|
||||
|
@ -0,0 +1,4 @@
|
||||
1557136800 1557169200
|
||||
1
|
||||
1
|
||||
1
|
@ -0,0 +1,29 @@
|
||||
DROP TABLE IF EXISTS tztest;
|
||||
|
||||
CREATE TABLE tztest
|
||||
(
|
||||
timeBerlin DateTime('Europe/Berlin'),
|
||||
timeLA DateTime('America/Los_Angeles')
|
||||
)
|
||||
ENGINE = Memory;
|
||||
|
||||
INSERT INTO tztest (timeBerlin, timeLA) VALUES ('2019-05-06 12:00:00', '2019-05-06 12:00:00');
|
||||
|
||||
SELECT
|
||||
toUnixTimestamp(timeBerlin),
|
||||
toUnixTimestamp(timeLA)
|
||||
FROM tztest;
|
||||
|
||||
SELECT 1
|
||||
FROM tztest
|
||||
WHERE timeBerlin = '2019-05-06 12:00:00';
|
||||
|
||||
SELECT 1
|
||||
FROM tztest
|
||||
WHERE timeLA = '2019-05-06 12:00:00';
|
||||
|
||||
SELECT 1
|
||||
FROM tztest
|
||||
WHERE '2019-05-06 12:00:00' = timeBerlin;
|
||||
|
||||
DROP TABLE tztest;
|
Loading…
Reference in New Issue
Block a user