Make substring function name case-insensitive + add two aliases #3704

This commit is contained in:
Ivan Blinkov 2018-12-06 17:30:10 +03:00
parent ed04453122
commit afcd6f9f09
3 changed files with 9 additions and 1 deletions

View File

@ -166,7 +166,9 @@ public:
void registerFunctionSubstring(FunctionFactory & factory) void registerFunctionSubstring(FunctionFactory & factory)
{ {
factory.registerFunction<FunctionSubstring>(); factory.registerFunction<FunctionSubstring>(FunctionFactory::CaseInsensitive);
factory.registerAlias("substr", FunctionSubstring::name, FunctionFactory::CaseInsensitive);
factory.registerAlias("mid", FunctionSubstring::name, FunctionFactory::CaseInsensitive); /// from MySQL dialect
} }
} }

View File

@ -4,3 +4,6 @@ foo
FOO FOO
baz baz
2 2
fo
oo
o

View File

@ -6,3 +6,6 @@ select LOWER('Foo');
select UPPER('Foo'); select UPPER('Foo');
select REPLACE('bar', 'r', 'z'); select REPLACE('bar', 'r', 'z');
select Locate('foo', 'o'); select Locate('foo', 'o');
select SUBSTRING('foo', 1, 2);
select Substr('foo', 2);
select mid('foo', 3);