Show create query for temporary tables in system.tables

This commit is contained in:
Vitaly Baranov 2020-12-11 22:44:18 +03:00
parent ede755d3bc
commit af3ccb49f1
2 changed files with 6 additions and 2 deletions

View File

@ -199,7 +199,11 @@ protected:
// create_table_query // create_table_query
if (columns_mask[src_index++]) if (columns_mask[src_index++])
res_columns[res_index++]->insertDefault(); {
auto temp_db = DatabaseCatalog::instance().getDatabaseForTemporaryTables();
ASTPtr ast = temp_db ? temp_db->tryGetCreateTableQuery(table.second->getStorageID().getTableName(), context) : nullptr;
res_columns[res_index++]->insert(ast ? queryToString(ast) : "");
}
// engine_full // engine_full
if (columns_mask[src_index++]) if (columns_mask[src_index++])

View File

@ -2,7 +2,7 @@
1 1
1 1
1 1
t_00693 Memory 1 [] 1970-01-01 00:00:00 [] [] Memory \N \N t_00693 Memory 1 [] 1970-01-01 00:00:00 [] [] CREATE TEMPORARY TABLE t_00693 (`x` UInt8) ENGINE = Memory Memory \N \N
1 1
1 1
1 1