dbms: fix [#METR-13667]

This commit is contained in:
Pavel Kartavyy 2014-11-13 17:01:29 +03:00
parent 14c231c055
commit 140b4545dd

View File

@ -75,20 +75,20 @@ BlockInputStreams StorageSystemTables::read(
ColumnWithNameAndType StorageSystemTables::getFilteredDatabases(ASTPtr query) ColumnWithNameAndType StorageSystemTables::getFilteredDatabases(ASTPtr query)
{ {
ColumnWithNameAndType filtered_databases_column; ColumnWithNameAndType column;
filtered_databases_column.name = "database"; column.name = "database";
filtered_databases_column.type = new DataTypeString; column.type = new DataTypeString;
filtered_databases_column.column = new ColumnString; column.column = new ColumnString;
Block filtered_databases_block; Block block;
filtered_databases_block.insert(filtered_databases_column); block.insert(column);
for (auto database_it = context.getDatabases().begin(); database_it != context.getDatabases().end(); ++database_it) for (auto database_it = context.getDatabases().begin(); database_it != context.getDatabases().end(); ++database_it)
{ {
filtered_databases_column.column->insert(database_it->first); column.column->insert(database_it->first);
} }
VirtualColumnUtils::filterBlockWithQuery(query, filtered_databases_block, context); VirtualColumnUtils::filterBlockWithQuery(query, block, context);
return filtered_databases_column; return block.getByPosition(0);
} }
} }