Added test with Date and numbers comparsion.

This commit is contained in:
Nikolai Kochetov 2018-11-28 14:37:07 +03:00
parent 6bd61d17c9
commit 05ac77dbde
3 changed files with 20 additions and 1 deletions

View File

@ -1093,7 +1093,7 @@ public:
const DataTypeTuple * right_tuple = checkAndGetDataType<DataTypeTuple>(arguments[1].get());
bool both_represented_by_number = arguments[0]->isValueRepresentedByNumber() && arguments[1]->isValueRepresentedByNumber();
bool has_date = left.isDate() && right.isDate();
bool has_date = left.isDate() || right.isDate();
if (!((both_represented_by_number && !has_date) /// Do not allow compare date and number.
|| (left.isStringOrFixedString() && right.isStringOrFixedString())

View File

@ -0,0 +1,6 @@
0
1
0
0
1
0

View File

@ -0,0 +1,13 @@
SET send_logs_level = 'none';
select toDate('2018-01-01') < '2018-01-01';
select toDate('2018-01-01') == '2018-01-01';
select toDate('2018-01-01') != '2018-01-01';
select toDate('2018-01-01') < toDate('2018-01-01');
select toDate('2018-01-01') == toDate('2018-01-01');
select toDate('2018-01-01') != toDate('2018-01-01');
select toDate('2018-01-01') < 1; -- { serverError 43 }
select toDate('2018-01-01') == 1; -- { serverError 43 }
select toDate('2018-01-01') != 1; -- { serverError 43 }