Fixed error in prev. revision [#CLICKHOUSE-3806]

This commit is contained in:
Alexey Milovidov 2018-07-06 00:26:23 +03:00
parent 88c582106b
commit 67b9a69f19

View File

@ -52,17 +52,27 @@ StorageMerge::StorageMerge(
NameAndTypePair StorageMerge::getColumn(const String & column_name) const
{
/// virtual column of the Merge table itself
if (column_name == "_table")
return { column_name, std::make_shared<DataTypeString>() };
/// virtual (and real) columns of the underlying tables
auto first_table = getFirstTable([](auto &&) { return true; });
if (first_table)
return first_table->getColumn(column_name);
return IStorage::getColumn(column_name);
}
bool StorageMerge::hasColumn(const String & column_name) const
{
if (column_name == "_table")
return true;
auto first_table = getFirstTable([](auto &&) { return true; });
if (first_table)
return first_table->hasColumn(column_name);
return IStorage::hasColumn(column_name);
}