mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
fix uncaught exception while getting mysql table schema
Signed-off-by: Duc Canh Le <duccanh.le@ahrefs.com>
This commit is contained in:
parent
cc165f9349
commit
21c49f6a0a
@ -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);
|
||||
|
||||
fetchTablesIntoLocalCache(local_context);
|
||||
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())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user