diff --git a/dbms/src/Functions/substring.cpp b/dbms/src/Functions/substring.cpp index e0a6d707243..7263f3ec595 100644 --- a/dbms/src/Functions/substring.cpp +++ b/dbms/src/Functions/substring.cpp @@ -166,7 +166,9 @@ public: void registerFunctionSubstring(FunctionFactory & factory) { - factory.registerFunction(); + factory.registerFunction(FunctionFactory::CaseInsensitive); + factory.registerAlias("substr", FunctionSubstring::name, FunctionFactory::CaseInsensitive); + factory.registerAlias("mid", FunctionSubstring::name, FunctionFactory::CaseInsensitive); /// from MySQL dialect } } diff --git a/dbms/tests/queries/0_stateless/00765_sql_compatibility_aliases.reference b/dbms/tests/queries/0_stateless/00765_sql_compatibility_aliases.reference index 439957db622..152c2182d69 100644 --- a/dbms/tests/queries/0_stateless/00765_sql_compatibility_aliases.reference +++ b/dbms/tests/queries/0_stateless/00765_sql_compatibility_aliases.reference @@ -4,3 +4,6 @@ foo FOO baz 2 +fo +oo +o diff --git a/dbms/tests/queries/0_stateless/00765_sql_compatibility_aliases.sql b/dbms/tests/queries/0_stateless/00765_sql_compatibility_aliases.sql index 791231b9598..85b33efa485 100644 --- a/dbms/tests/queries/0_stateless/00765_sql_compatibility_aliases.sql +++ b/dbms/tests/queries/0_stateless/00765_sql_compatibility_aliases.sql @@ -6,3 +6,6 @@ select LOWER('Foo'); select UPPER('Foo'); select REPLACE('bar', 'r', 'z'); select Locate('foo', 'o'); +select SUBSTRING('foo', 1, 2); +select Substr('foo', 2); +select mid('foo', 3);