Skip to content

Commit abb7d08

Browse files
committed
address comment
1 parent a971570 commit abb7d08

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/catalog/catalog.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -952,16 +952,14 @@ optional_ptr<SchemaCatalogEntry> Catalog::GetSchema(CatalogEntryRetriever &retri
952952
const string &schema_name, OnEntryNotFound if_not_found,
953953
QueryErrorContext error_context) {
954954
auto entries = GetCatalogEntries(retriever, catalog_name, schema_name);
955-
auto &context = retriever.GetContext();
956955
for (idx_t i = 0; i < entries.size(); i++) {
957-
auto entry_name = IsInvalidCatalog(entries[i].catalog) ? GetDefaultCatalog(retriever) : entries[i].catalog;
958-
// check whether the catalog is attached before trying to get it
959-
if (!context.db->GetDatabaseManager().GetDatabase(context, entry_name)) {
956+
auto catalog = Catalog::GetCatalogEntry(retriever, entries[i].catalog);
957+
if (!catalog) {
958+
// skip if it is not an attached database
960959
continue;
961960
}
962961
auto on_not_found = i + 1 == entries.size() ? if_not_found : OnEntryNotFound::RETURN_NULL;
963-
auto &catalog = Catalog::GetCatalog(retriever, entries[i].catalog);
964-
auto result = catalog.GetSchema(context, schema_name, on_not_found, error_context);
962+
auto result = catalog->GetSchema(retriever.GetContext(), schema_name, on_not_found, error_context);
965963
if (result) {
966964
return result;
967965
}

0 commit comments

Comments
 (0)