| 31 | } |
| 32 | |
| 33 | StoragePtr IDatabase::getTable(const String & name, ContextPtr context) const |
| 34 | { |
| 35 | if (auto storage = tryGetTable(name, context)) |
| 36 | return storage; |
| 37 | |
| 38 | TableNameHints hints(this->shared_from_this(), context); |
| 39 | /// hint is a pair which holds a single database_name and table_name suggestion for the given table name. |
| 40 | auto hint = hints.getHintForTable(name); |
| 41 | |
| 42 | if (hint.first.empty()) |
| 43 | throw Exception(ErrorCodes::UNKNOWN_TABLE, "Table {}.{} does not exist", backQuoteIfNeed(getDatabaseName()), backQuoteIfNeed(name)); |
| 44 | throw Exception( |
| 45 | ErrorCodes::UNKNOWN_TABLE, |
| 46 | "Table {}.{} does not exist. Maybe you meant {}.{}?", |
| 47 | backQuoteIfNeed(getDatabaseName()), |
| 48 | backQuoteIfNeed(name), |
| 49 | backQuoteIfNeed(hint.first), |
| 50 | backQuoteIfNeed(hint.second)); |
| 51 | } |
| 52 | |
| 53 | IDatabase::IDatabase(String database_name_) : database_name(std::move(database_name_)) |
| 54 | { |
no test coverage detected