diff --git a/src/Functions/toYear.cpp b/src/Functions/toYear.cpp index 870582e2ccd..8db857c132e 100644 --- a/src/Functions/toYear.cpp +++ b/src/Functions/toYear.cpp @@ -12,6 +12,8 @@ using FunctionToYear = FunctionDateOrDateTimeToSomething(); + /// MysQL compatibility alias. + factory.registerFunction("YEAR", FunctionFactory::CaseInsensitive); } } diff --git a/tests/queries/0_stateless/01669_test_toYear_mysql_dialect.reference b/tests/queries/0_stateless/01669_test_toYear_mysql_dialect.reference new file mode 100644 index 00000000000..6f6d045ba55 --- /dev/null +++ b/tests/queries/0_stateless/01669_test_toYear_mysql_dialect.reference @@ -0,0 +1 @@ +2016 diff --git a/tests/queries/0_stateless/01669_test_toYear_mysql_dialect.sql b/tests/queries/0_stateless/01669_test_toYear_mysql_dialect.sql new file mode 100644 index 00000000000..f7cd84314e2 --- /dev/null +++ b/tests/queries/0_stateless/01669_test_toYear_mysql_dialect.sql @@ -0,0 +1 @@ +SELECT YEAR(toDateTime('2016-06-15 23:00:00')); \ No newline at end of file