Use existing alias as external table name

This commit is contained in:
Ivan Lezhankin 2019-09-13 16:25:24 +03:00
parent a3944624a0
commit dc49303baf

View File

@ -78,13 +78,17 @@ public:
return;
}
String external_table_name = subquery_or_table_name->tryGetAlias();
if (external_table_name.empty())
{
/// Generate the name for the external table.
String external_table_name = "_data" + toString(external_table_id);
external_table_name = "_data" + toString(external_table_id);
while (external_tables.count(external_table_name))
{
++external_table_id;
external_table_name = "_data" + toString(external_table_id);
}
}
auto interpreter = interpretSubquery(subquery_or_table_name, context, subquery_depth, {});