Now concat always return string column

This commit is contained in:
alesapin 2019-11-05 16:23:09 +03:00
parent 6a871f579f
commit 2d7ae27232
3 changed files with 8 additions and 1 deletions

View File

@ -214,7 +214,8 @@ protected:
+ ", should be at least 2.", + ", should be at least 2.",
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
return getLeastSupertype(arguments); /// We always return Strings from concat, even if arguments were fixed strings.
return std::make_shared<DataTypeString>();
} }
private: private:

View File

@ -0,0 +1,3 @@
aa aaaa
aa 4
aa String

View File

@ -0,0 +1,3 @@
SELECT toFixedString('aa' , 2 ) as a, concat(a, a);
SELECT toFixedString('aa' , 2 ) as a, length(concat(a, a));
SELECT toFixedString('aa' , 2 ) as a, toTypeName(concat(a, a));