mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
ClickHouse: not accepting identifiers with multiple dots. [#METR-11739]
This commit is contained in:
parent
0ff3ede227
commit
3efa9e91c9
@ -252,6 +252,7 @@ namespace ErrorCodes
|
||||
TABLE_IS_READ_ONLY,
|
||||
NOT_ENOUGH_SPACE,
|
||||
UNEXPECTED_ZOOKEEPER_ERROR,
|
||||
INVALID_NESTED_NAME,
|
||||
|
||||
POCO_EXCEPTION = 1000,
|
||||
STD_EXCEPTION,
|
||||
|
@ -33,15 +33,21 @@ std::string DataTypeNested::concatenateNestedName(const std::string & nested_tab
|
||||
|
||||
std::string DataTypeNested::extractNestedTableName(const std::string & nested_name)
|
||||
{
|
||||
const char * pos = strchr(nested_name.data(), '.');
|
||||
return pos == nullptr ? nested_name : nested_name.substr(0, pos - nested_name.data());
|
||||
const char * first_pos = strchr(nested_name.data(), '.');
|
||||
const char * last_pos = strrchr(nested_name.data(), '.');
|
||||
if (first_pos != last_pos)
|
||||
throw Exception("Invalid nested column name: " + nested_name, ErrorCodes::INVALID_NESTED_NAME);
|
||||
return first_pos == nullptr ? nested_name : nested_name.substr(0, first_pos - nested_name.data());
|
||||
}
|
||||
|
||||
|
||||
std::string DataTypeNested::extractNestedColumnName(const std::string & nested_name)
|
||||
{
|
||||
const char * pos = strrchr(nested_name.data(), '.');
|
||||
return pos == nullptr ? nested_name : nested_name.substr(pos - nested_name.data() + 1);
|
||||
const char * first_pos = strchr(nested_name.data(), '.');
|
||||
const char * last_pos = strrchr(nested_name.data(), '.');
|
||||
if (first_pos != last_pos)
|
||||
throw Exception("Invalid nested column name: " + nested_name, ErrorCodes::INVALID_NESTED_NAME);
|
||||
return last_pos == nullptr ? nested_name : nested_name.substr(last_pos - nested_name.data() + 1);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user