Skip to content

Commit

Permalink
fix more bugs, introduced by me
Browse files Browse the repository at this point in the history
  • Loading branch information
Tishj committed Oct 26, 2023
1 parent 0589a3a commit 8fd3cc5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/catalog/catalog_entry/dependency_set_catalog_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
namespace duckdb {

DependencySetCatalogEntry::DependencySetCatalogEntry(Catalog &catalog, const string &name)
: InCatalogEntry(CatalogType::DEPENDENCY_SET, catalog, name), dependencies(catalog), dependents(catalog) {
: InCatalogEntry(CatalogType::DEPENDENCY_SET, catalog, name), name(name), dependencies(catalog),
dependents(catalog) {
}

CatalogSet &DependencySetCatalogEntry::Dependencies() {
Expand Down
18 changes: 11 additions & 7 deletions src/catalog/dependency_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ static bool CascadeDrop(bool cascade, DependencyType dependency_type) {
}

void UnmangleName(const string &mangled, string &schema, string &name, CatalogType &type) {
auto parts = StringUtil::Split(mangled, "\0");
auto parts = StringUtil::Split(mangled, std::string("\0", 1));
D_ASSERT(parts.size() == 3);
schema = std::move(parts[0]);
name = std::move(parts[1]);
type = CatalogTypeFromString(parts[2]);
type = CatalogTypeFromString(parts[0]);
schema = std::move(parts[1]);
name = std::move(parts[2]);
}

void GetLookupProperties(CatalogEntry &entry, string &schema, string &name, CatalogType &type) {
Expand Down Expand Up @@ -200,8 +200,10 @@ optional_ptr<CatalogEntry> DependencyManager::LookupEntry(CatalogTransaction tra
if (type == CatalogType::SCHEMA_ENTRY) {
// This is a schema entry, perform the callback only providing the schema
auto entry = dynamic_cast<CatalogEntry *>(&schema_entry);
callback(entry, nullptr, nullptr);
return nullptr;
if (callback) {
callback(entry, nullptr, nullptr);
}
return entry;
}
auto &duck_schema_entry = schema_entry.Cast<DuckSchemaEntry>();

Expand All @@ -211,7 +213,9 @@ optional_ptr<CatalogEntry> DependencyManager::LookupEntry(CatalogTransaction tra
// Get the mapping from name -> index
auto mapping_value = catalog_set.GetMapping(transaction, name, /* get_latest = */ true);
if (!mapping_value) {
callback(nullptr, &catalog_set, nullptr);
if (callback) {
callback(nullptr, &catalog_set, nullptr);
}
return nullptr;
}
// Use the index to find the actual entry
Expand Down

0 comments on commit 8fd3cc5

Please sign in to comment.