ClickHouse: throwing exception on nested nested types. [#CONV-2807]

This commit is contained in:
Michael Kolupaev 2013-10-11 07:41:13 +00:00
parent a997258e26
commit 6a63256dc9
2 changed files with 5 additions and 1 deletions

View File

@ -210,6 +210,7 @@ namespace ErrorCodes
TOO_MUCH_SIMULTANEOUS_QUERIES,
NO_FREE_CONNECTION,
CANNOT_FSYNC,
NESTED_TYPE_TOO_DEEP,
POCO_EXCEPTION = 1000,
STD_EXCEPTION,

View File

@ -114,9 +114,12 @@ DataTypePtr DataTypeFactory::get(const String & name) const
{
ASTNameTypePair & name_and_type_pair = dynamic_cast<ASTNameTypePair &>(**it);
StringRange type_range = name_and_type_pair.type->range;
DataTypePtr type = get(String(type_range.first, type_range.second - type_range.first));
if (dynamic_cast<const DataTypeNested*>(&*type))
throw Exception("Nested inside Nested is not allowed", ErrorCodes::NESTED_TYPE_TOO_DEEP);
columns->push_back(NameAndTypePair(
name_and_type_pair.name,
get(String(type_range.first, type_range.second - type_range.first))));
type));
}
return new DataTypeNested(columns);