mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Merge pull request #47573 from azat/odbc-fix
Change error code in case of columns definitions was empty in ODBC
This commit is contained in:
commit
9d14c14a54
@ -30,7 +30,7 @@ namespace DB
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int LOGICAL_ERROR;
|
||||
extern const int UNKNOWN_TABLE;
|
||||
extern const int BAD_ARGUMENTS;
|
||||
}
|
||||
|
||||
@ -180,8 +180,19 @@ void ODBCColumnsInfoHandler::handleRequest(HTTPServerRequest & request, HTTPServ
|
||||
columns.emplace_back(column_name, std::move(column_type));
|
||||
}
|
||||
|
||||
/// Usually this should not happen, since in case of table does not
|
||||
/// exists, the call should be succeeded.
|
||||
/// However it is possible sometimes because internally there are two
|
||||
/// queries in ClickHouse ODBC bridge:
|
||||
/// - system.tables
|
||||
/// - system.columns
|
||||
/// And if between this two queries the table will be removed, them
|
||||
/// there will be no columns
|
||||
///
|
||||
/// Also sometimes system.columns can return empty result because of
|
||||
/// the cached value of total tables to scan.
|
||||
if (columns.empty())
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Columns definition was not returned");
|
||||
throw Exception(ErrorCodes::UNKNOWN_TABLE, "Columns definition was not returned");
|
||||
|
||||
WriteBufferFromHTTPServerResponse out(
|
||||
response,
|
||||
|
Loading…
Reference in New Issue
Block a user