mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Merge pull request #3774 from yandex/missing-sql-compatibility-functions
Some function name aliases and case insensitivity for SQL compatibility
This commit is contained in:
commit
8ad92ad94f
@ -1088,5 +1088,7 @@ void registerFunctionsStringSearch(FunctionFactory & factory)
|
||||
factory.registerFunction<FunctionLike>();
|
||||
factory.registerFunction<FunctionNotLike>();
|
||||
factory.registerFunction<FunctionExtract>();
|
||||
factory.registerAlias("locate", NamePosition::name, FunctionFactory::CaseInsensitive);
|
||||
factory.registerAlias("replace", NameReplaceAll::name, FunctionFactory::CaseInsensitive);
|
||||
}
|
||||
}
|
||||
|
@ -936,7 +936,7 @@ public:
|
||||
|
||||
void registerFunctionIf(FunctionFactory & factory)
|
||||
{
|
||||
factory.registerFunction<FunctionIf>();
|
||||
factory.registerFunction<FunctionIf>(FunctionFactory::CaseInsensitive);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ using FunctionLower = FunctionStringToString<LowerUpperImpl<'A', 'Z'>, NameLower
|
||||
void registerFunctionLower(FunctionFactory & factory)
|
||||
{
|
||||
factory.registerFunction<FunctionLower>(FunctionFactory::CaseInsensitive);
|
||||
factory.registerAlias("lcase", "lower", FunctionFactory::CaseInsensitive);
|
||||
factory.registerAlias("lcase", NameLower::name, FunctionFactory::CaseInsensitive);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -166,7 +166,9 @@ public:
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ using FunctionUpper = FunctionStringToString<LowerUpperImpl<'a', 'z'>, NameUpper
|
||||
void registerFunctionUpper(FunctionFactory & factory)
|
||||
{
|
||||
factory.registerFunction<FunctionUpper>(FunctionFactory::CaseInsensitive);
|
||||
factory.registerAlias("ucase", "upper", FunctionFactory::CaseInsensitive);
|
||||
factory.registerAlias("ucase", FunctionUpper::name, FunctionFactory::CaseInsensitive);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,3 +2,9 @@ foo
|
||||
FOO
|
||||
foo
|
||||
FOO
|
||||
baz
|
||||
2
|
||||
fo
|
||||
oo
|
||||
o
|
||||
1
|
||||
|
@ -4,3 +4,9 @@ select lcase('FOO');
|
||||
select ucase('foo');
|
||||
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);
|
||||
select IF(3>2, 1, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user