Skip to content

Commit 217fa3f

Browse files
committed
check if catalog is attached before grabbing
1 parent 12d1051 commit 217fa3f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/catalog/catalog.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,12 @@ 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();
955956
for (idx_t i = 0; i < entries.size(); i++) {
957+
if (!context.db->GetDatabaseManager().GetDatabase(context, entries[i].catalog)) {
958+
// check if the catalog is attached before we try to get the catalog
959+
continue;
960+
}
956961
auto on_not_found = i + 1 == entries.size() ? if_not_found : OnEntryNotFound::RETURN_NULL;
957962
auto &catalog = Catalog::GetCatalog(retriever, entries[i].catalog);
958963
auto result = catalog.GetSchema(retriever.GetContext(), schema_name, on_not_found, error_context);

0 commit comments

Comments
 (0)