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,12 +78,16 @@ public:
return;
}
/// Generate the name for the external table.
String external_table_name = "_data" + toString(external_table_id);
while (external_tables.count(external_table_name))
String external_table_name = subquery_or_table_name->tryGetAlias();
if (external_table_name.empty())
{
++external_table_id;
/// Generate the name for the external table.
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, {});