Skip to content

add checks to block main graph create/drop#542

Open
aheev wants to merge 1 commit into
LadybugDB:mainfrom
aheev:block-create-graph-main
Open

add checks to block main graph create/drop#542
aheev wants to merge 1 commit into
LadybugDB:mainfrom
aheev:block-create-graph-main

Conversation

@aheev
Copy link
Copy Markdown
Contributor

@aheev aheev commented May 30, 2026

Closes #541

@aheev
Copy link
Copy Markdown
Contributor Author

aheev commented May 30, 2026

curious, why were these checks added to drop operator class?

    auto dbManager = main::DatabaseManager::Get(*context);
    auto memoryManager = storage::MemoryManager::Get(*context);

    if (!dbManager->hasGraph(dropInfo.name)) {
        auto message = std::format("Graph {} does not exist.", dropInfo.name);
        switch (dropInfo.conflictAction) {
        case ConflictAction::ON_CONFLICT_DO_NOTHING: {
            appendMessage(message, memoryManager);
            return;
        }
        case ConflictAction::ON_CONFLICT_THROW: {
            throw BinderException(message);
        }
        default:
            UNREACHABLE_CODE;
        }
    }

    if (dbManager->hasDefaultGraph() && StringUtils::getUpper(dbManager->getDefaultGraphName()) ==
                                            StringUtils::getUpper(dropInfo.name)) {
        dbManager->clearDefaultGraph();
    }

    dbManager->dropGraph(dropInfo.name, const_cast<main::ClientContext*>(context));
    appendMessage(std::format("Graph {} has been dropped.", dropInfo.name), memoryManager);

it just calls dbManager functions, so, why not move this to dbManager and just call dbManager->dropGraph here?

@adsharma
Copy link
Copy Markdown
Contributor

Only the defaultGraph checking could be moved to the dbManager. The rest of it should stay in the drop operator because it's user facing cypher behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: nodejs open type graph error

2 participants