1#include "duckdb/execution/operator/schema/physical_detach.hpp"
2#include "duckdb/parser/parsed_data/detach_info.hpp"
3#include "duckdb/catalog/catalog.hpp"
4#include "duckdb/main/database_manager.hpp"
5#include "duckdb/main/attached_database.hpp"
6#include "duckdb/main/database.hpp"
7#include "duckdb/storage/storage_extension.hpp"
8
9namespace duckdb {
10
11//===--------------------------------------------------------------------===//
12// Source
13//===--------------------------------------------------------------------===//
14SourceResultType PhysicalDetach::GetData(ExecutionContext &context, DataChunk &chunk,
15 OperatorSourceInput &input) const {
16 auto &db_manager = DatabaseManager::Get(db&: context.client);
17 db_manager.DetachDatabase(context&: context.client, name: info->name, if_not_found: info->if_not_found);
18
19 return SourceResultType::FINISHED;
20}
21
22} // namespace duckdb
23