This commit is contained in:
Duc Canh Le 2024-09-18 16:18:46 -04:00 committed by GitHub
commit 6c9956b6ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,6 +50,7 @@ namespace ErrorCodes
extern const int UNEXPECTED_AST_STRUCTURE;
extern const int CANNOT_CREATE_DATABASE;
extern const int BAD_ARGUMENTS;
extern const int CANNOT_GET_CREATE_TABLE_QUERY;
}
constexpr static const auto suffix = ".remove_flag";
@ -142,7 +143,23 @@ ASTPtr DatabaseMySQL::getCreateTableQueryImpl(const String & table_name, Context
{
std::lock_guard lock(mutex);
try
{
/// This function can throw mysql exception, we don't have enough context to handle it
/// So we just catch and re-throw as known exception if needed.
fetchTablesIntoLocalCache(local_context);
}
catch (...)
{
if (throw_on_error)
{
throw Exception(ErrorCodes::CANNOT_GET_CREATE_TABLE_QUERY,
"Received error while fetching table structure for table {} from MySQL: {}",
backQuote(table_name), getCurrentExceptionMessage(true));
}
tryLogCurrentException(__PRETTY_FUNCTION__);
}
if (local_tables_cache.find(table_name) == local_tables_cache.end())
{