Merge pull request #44517 from kssenii/better-error-message

Better error message if named collection does not exist
This commit is contained in:
Kseniia Sumarokova 2022-12-23 11:39:06 +01:00 committed by GitHub
commit 068f2f329b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -25,7 +25,7 @@ namespace
return nullptr; return nullptr;
const auto & collection_name = identifier->name(); const auto & collection_name = identifier->name();
return NamedCollectionFactory::instance().tryGet(collection_name); return NamedCollectionFactory::instance().get(collection_name);
} }
std::optional<std::pair<std::string, Field>> getKeyValueFromAST(ASTPtr ast) std::optional<std::pair<std::string, Field>> getKeyValueFromAST(ASTPtr ast)

View File

@ -1013,6 +1013,9 @@ def test_predefined_connection_configuration(started_cluster):
) )
assert result == instance.query("SELECT number FROM numbers(10)") assert result == instance.query("SELECT number FROM numbers(10)")
result = instance.query_and_get_error("SELECT * FROM s3(no_collection)")
assert "There is no named collection `no_collection`" in result
result = "" result = ""