Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::DuckCatalog Class Reference

The Catalog object represents the catalog of the database. More...

Inheritance diagram for duckdb::DuckCatalog:
Collaboration diagram for duckdb::DuckCatalog:

Public Member Functions

 DuckCatalog (AttachedDatabase &db)
 
bool IsDuckCatalog () override
 
void Initialize (bool load_builtin) override
 
string GetCatalogType () override
 
mutex & GetWriteLock ()
 
void SetEncryptionKeyId (const string &key_id)
 
string & GetEncryptionKeyId ()
 
void SetIsEncrypted ()
 
bool GetIsEncrypted ()
 
DUCKDB_API optional_ptr< CatalogEntryCreateSchema (CatalogTransaction transaction, CreateSchemaInfo &info) override
 Creates a schema in the catalog.
 
DUCKDB_API void ScanSchemas (ClientContext &context, std::function< void(SchemaCatalogEntry &)> callback) override
 Scans all the schemas in the system one-by-one, invoking the callback for each entry.
 
DUCKDB_API void ScanSchemas (std::function< void(SchemaCatalogEntry &)> callback)
 
DUCKDB_API optional_ptr< SchemaCatalogEntryLookupSchema (CatalogTransaction transaction, const EntryLookupInfo &schema_lookup, OnEntryNotFound if_not_found) override
 
DUCKDB_API PhysicalOperatorPlanCreateTableAs (ClientContext &context, PhysicalPlanGenerator &planner, LogicalCreateTable &op, PhysicalOperator &plan) override
 
DUCKDB_API PhysicalOperatorPlanInsert (ClientContext &context, PhysicalPlanGenerator &planner, LogicalInsert &op, optional_ptr< PhysicalOperator > plan) override
 
DUCKDB_API PhysicalOperatorPlanDelete (ClientContext &context, PhysicalPlanGenerator &planner, LogicalDelete &op, PhysicalOperator &plan) override
 
DUCKDB_API PhysicalOperatorPlanUpdate (ClientContext &context, PhysicalPlanGenerator &planner, LogicalUpdate &op, PhysicalOperator &plan) override
 
DUCKDB_API PhysicalOperatorPlanMergeInto (ClientContext &context, PhysicalPlanGenerator &planner, LogicalMergeInto &op, PhysicalOperator &plan) override
 
DUCKDB_API unique_ptr< LogicalOperatorBindCreateIndex (Binder &binder, CreateStatement &stmt, TableCatalogEntry &table, unique_ptr< LogicalOperator > plan) override
 
DUCKDB_API unique_ptr< LogicalOperatorBindAlterAddIndex (Binder &binder, TableCatalogEntry &table_entry, unique_ptr< LogicalOperator > plan, unique_ptr< CreateIndexInfo > create_info, unique_ptr< AlterTableInfo > alter_info) override
 
CatalogSetGetSchemaCatalogSet ()
 
DatabaseSize GetDatabaseSize (ClientContext &context) override
 
vector< MetadataBlockInfoGetMetadataInfo (ClientContext &context) override
 
DUCKDB_API bool InMemory () override
 
DUCKDB_API string GetDBPath () override
 
DUCKDB_API bool IsEncrypted () const override
 
DUCKDB_API string GetEncryptionCipher () const override
 
DUCKDB_API optional_idx GetCatalogVersion (ClientContext &context) override
 
optional_ptr< DependencyManagerGetDependencyManager () override
 Returns the dependency manager of this catalog - if the catalog has anye.
 
- Public Member Functions inherited from duckdb::Catalog
 Catalog (AttachedDatabase &db)
 
DUCKDB_API AttachedDatabaseGetAttached ()
 
DUCKDB_API const AttachedDatabaseGetAttached () const
 
DUCKDB_API DatabaseInstanceGetDatabase ()
 
virtual void Initialize (optional_ptr< ClientContext > context, bool load_builtin)
 
virtual void FinalizeLoad (optional_ptr< ClientContext > context)
 
bool IsSystemCatalog () const
 
bool IsTemporaryCatalog () const
 
DUCKDB_API const string & GetName () const
 Returns the catalog name - based on how the catalog was attached.
 
DUCKDB_API idx_t GetOid ()
 
DUCKDB_API CatalogTransaction GetCatalogTransaction (ClientContext &context)
 
DUCKDB_API optional_ptr< CatalogEntryCreateSchema (ClientContext &context, CreateSchemaInfo &info)
 
DUCKDB_API optional_ptr< CatalogEntryCreateTable (CatalogTransaction transaction, BoundCreateTableInfo &info)
 Creates a table in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateTable (ClientContext &context, BoundCreateTableInfo &info)
 
DUCKDB_API optional_ptr< CatalogEntryCreateTable (ClientContext &context, unique_ptr< CreateTableInfo > info)
 Creates a table in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateTableFunction (CatalogTransaction transaction, CreateTableFunctionInfo &info)
 Create a table function in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateTableFunction (ClientContext &context, CreateTableFunctionInfo &info)
 
DUCKDB_API optional_ptr< CatalogEntryCreateTableFunction (ClientContext &context, optional_ptr< CreateTableFunctionInfo > info)
 
DUCKDB_API optional_ptr< CatalogEntryCreateCopyFunction (CatalogTransaction transaction, CreateCopyFunctionInfo &info)
 Create a copy function in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateCopyFunction (ClientContext &context, CreateCopyFunctionInfo &info)
 
DUCKDB_API optional_ptr< CatalogEntryCreatePragmaFunction (CatalogTransaction transaction, CreatePragmaFunctionInfo &info)
 Create a pragma function in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreatePragmaFunction (ClientContext &context, CreatePragmaFunctionInfo &info)
 
DUCKDB_API optional_ptr< CatalogEntryCreateFunction (CatalogTransaction transaction, CreateFunctionInfo &info)
 Create a scalar or aggregate function in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateFunction (ClientContext &context, CreateFunctionInfo &info)
 
DUCKDB_API optional_ptr< CatalogEntryCreateView (CatalogTransaction transaction, CreateViewInfo &info)
 Creates a table in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateView (ClientContext &context, CreateViewInfo &info)
 
DUCKDB_API optional_ptr< CatalogEntryCreateSequence (CatalogTransaction transaction, CreateSequenceInfo &info)
 Creates a sequence in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateSequence (ClientContext &context, CreateSequenceInfo &info)
 
DUCKDB_API optional_ptr< CatalogEntryCreateType (CatalogTransaction transaction, CreateTypeInfo &info)
 Creates a Enum in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateType (ClientContext &context, CreateTypeInfo &info)
 
DUCKDB_API optional_ptr< CatalogEntryCreateCollation (CatalogTransaction transaction, CreateCollationInfo &info)
 Creates a collation in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateCollation (ClientContext &context, CreateCollationInfo &info)
 
DUCKDB_API optional_ptr< CatalogEntryCreateCoordinateSystem (CatalogTransaction transaction, CreateCoordinateSystemInfo &info)
 Creates a coordinate system in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateCoordinateSystem (ClientContext &context, CreateCoordinateSystemInfo &info)
 
DUCKDB_API optional_ptr< CatalogEntryCreateIndex (CatalogTransaction transaction, CreateIndexInfo &info)
 Creates an index in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateIndex (ClientContext &context, CreateIndexInfo &info)
 
DUCKDB_API optional_ptr< CatalogEntryCreateTable (CatalogTransaction transaction, SchemaCatalogEntry &schema, BoundCreateTableInfo &info)
 Creates a table in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateTableFunction (CatalogTransaction transaction, SchemaCatalogEntry &schema, CreateTableFunctionInfo &info)
 Create a table function in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateCopyFunction (CatalogTransaction transaction, SchemaCatalogEntry &schema, CreateCopyFunctionInfo &info)
 Create a copy function in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreatePragmaFunction (CatalogTransaction transaction, SchemaCatalogEntry &schema, CreatePragmaFunctionInfo &info)
 Create a pragma function in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateFunction (CatalogTransaction transaction, SchemaCatalogEntry &schema, CreateFunctionInfo &info)
 Create a scalar or aggregate function in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateView (CatalogTransaction transaction, SchemaCatalogEntry &schema, CreateViewInfo &info)
 Creates a view in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateSequence (CatalogTransaction transaction, SchemaCatalogEntry &schema, CreateSequenceInfo &info)
 Creates a table in the catalog.
 
DUCKDB_API optional_ptr< CatalogEntryCreateType (CatalogTransaction transaction, SchemaCatalogEntry &schema, CreateTypeInfo &info)
 Creates a enum in the catalog.
 
DUCKDB_API void DropEntry (ClientContext &context, DropInfo &info)
 Drops an entry from the catalog.
 
DUCKDB_API SchemaCatalogEntryGetSchema (ClientContext &context, const EntryLookupInfo &schema_lookup)
 Returns the schema object with the specified name, or throws an exception if it does not exist.
 
DUCKDB_API optional_ptr< SchemaCatalogEntryGetSchema (ClientContext &context, const EntryLookupInfo &schema_lookup, OnEntryNotFound if_not_found)
 
virtual DUCKDB_API bool CheckAmbiguousCatalogOrSchema (ClientContext &context, const string &schema)
 Overloadable method for giving warnings on ambiguous naming id.tab due to a database and schema with name id.
 
DUCKDB_API SchemaCatalogEntryGetSchema (ClientContext &context, const string &schema)
 
DUCKDB_API SchemaCatalogEntryGetSchema (CatalogTransaction transaction, const string &schema)
 
DUCKDB_API SchemaCatalogEntryGetSchema (CatalogTransaction transaction, const EntryLookupInfo &schema_lookup)
 
DUCKDB_API optional_ptr< SchemaCatalogEntryGetSchema (ClientContext &context, const string &schema, OnEntryNotFound if_not_found)
 
DUCKDB_API optional_ptr< SchemaCatalogEntryGetSchema (CatalogTransaction transaction, const string &schema, OnEntryNotFound if_not_found)
 
DUCKDB_API optional_ptr< CatalogEntryGetEntry (ClientContext &context, const string &schema, const EntryLookupInfo &lookup_info, OnEntryNotFound if_not_found)
 Gets the "schema.name" entry of the specified type, if entry does not exist behavior depends on OnEntryNotFound.
 
DUCKDB_API optional_ptr< CatalogEntryGetEntry (ClientContext &context, CatalogType catalog_type, const string &schema, const string &name, OnEntryNotFound if_not_found)
 
DUCKDB_API optional_ptr< CatalogEntryGetEntry (CatalogEntryRetriever &retriever, const string &schema, const EntryLookupInfo &lookup_info, OnEntryNotFound if_not_found)
 
DUCKDB_API CatalogEntryGetEntry (ClientContext &context, const string &schema, const EntryLookupInfo &lookup_info)
 
template<class T >
optional_ptr< T > GetEntry (ClientContext &context, const string &schema_name, const string &name, OnEntryNotFound if_not_found, QueryErrorContext error_context=QueryErrorContext())
 
template<class T >
T & GetEntry (ClientContext &context, const string &schema_name, const string &name, QueryErrorContext error_context=QueryErrorContext())
 
CatalogEntryGetEntry (ClientContext &context, CatalogType catalog_type, const string &schema_name, const string &name)
 
DUCKDB_API optional_ptr< CatalogEntryAddFunction (ClientContext &context, CreateFunctionInfo &info)
 Append a scalar or aggregate function to the catalog.
 
DUCKDB_API void Alter (CatalogTransaction transaction, AlterInfo &info)
 Alter an existing entry in the catalog.
 
DUCKDB_API void Alter (ClientContext &context, AlterInfo &info)
 
virtual PhysicalOperatorPlanDelete (ClientContext &context, PhysicalPlanGenerator &planner, LogicalDelete &op)
 
virtual PhysicalOperatorPlanUpdate (ClientContext &context, PhysicalPlanGenerator &planner, LogicalUpdate &op)
 
virtual bool SupportsTimeTravel () const
 
virtual ErrorData SupportsCreateTable (BoundCreateTableInfo &info)
 
virtual DUCKDB_API CatalogLookupBehavior CatalogTypeLookupRule (CatalogType type) const
 Whether or not this catalog should search a specific type with the standard priority.
 
virtual string GetDefaultSchema () const
 Returns the default schema of the catalog.
 
DUCKDB_API bool HasDefaultTable () const
 Whether this catalog has a default table. Catalogs with a default table can be queries by their catalog name.
 
DUCKDB_API void SetDefaultTable (const string &schema, const string &name)
 
DUCKDB_API string GetDefaultTable () const
 
DUCKDB_API string GetDefaultTableSchema () const
 
virtual bool HasConflictingAttachOptions (const string &path, const AttachOptions &options)
 Whether attaching a catalog with the given path and attach options would be considered a conflict.
 
DUCKDB_API vector< reference< SchemaCatalogEntry > > GetSchemas (ClientContext &context)
 
virtual DUCKDB_API void OnDetach (ClientContext &context)
 Called when the catalog is detached.
 
CatalogEntryLookup LookupEntry (CatalogEntryRetriever &retriever, const string &schema, const EntryLookupInfo &lookup_info, OnEntryNotFound if_not_found)
 Lookup an entry using TryLookupEntry, throws if entry not found and if_not_found == THROW_EXCEPTION.
 
template<class TARGET >
TARGETCast ()
 
template<class TARGET >
const TARGETCast () const
 

Private Member Functions

DUCKDB_API void DropSchema (CatalogTransaction transaction, DropInfo &info)
 
DUCKDB_API void DropSchema (ClientContext &context, DropInfo &info) override
 
optional_ptr< CatalogEntryCreateSchemaInternal (CatalogTransaction transaction, CreateSchemaInfo &info)
 
void Verify () override
 

Private Attributes

unique_ptr< DependencyManagerdependency_manager
 The DependencyManager manages dependencies between different catalog objects.
 
mutex write_lock
 Write lock for the catalog.
 
unique_ptr< CatalogSetschemas
 The catalog set holding the schemas.
 
bool is_encrypted = false
 Identifies whether the db is encrypted.
 
string encryption_key_id
 If is encrypted, store the encryption key_id.
 

Additional Inherited Members

- Static Public Member Functions inherited from duckdb::Catalog
static DUCKDB_API CatalogGetSystemCatalog (ClientContext &context)
 Get the SystemCatalog from the ClientContext.
 
static DUCKDB_API CatalogGetSystemCatalog (DatabaseInstance &db)
 Get the SystemCatalog from the DatabaseInstance.
 
static DUCKDB_API CatalogGetCatalog (ClientContext &context, const string &catalog_name)
 Get the specified Catalog from the ClientContext.
 
static DUCKDB_API CatalogGetCatalog (CatalogEntryRetriever &retriever, const string &catalog_name)
 Get the specified Catalog from the ClientContext.
 
static DUCKDB_API CatalogGetCatalog (DatabaseInstance &db, const string &catalog_name)
 Get the specified Catalog from the DatabaseInstance.
 
static DUCKDB_API optional_ptr< CatalogGetCatalogEntry (ClientContext &context, const string &catalog_name)
 Gets the specified Catalog from the database if it exists.
 
static DUCKDB_API optional_ptr< CatalogGetCatalogEntry (CatalogEntryRetriever &retriever, const string &catalog_name)
 Gets the specified Catalog from the database if it exists.
 
static DUCKDB_API CatalogGetCatalog (AttachedDatabase &db)
 Get the specific Catalog from the AttachedDatabase.
 
static DUCKDB_API optional_ptr< CatalogEntryCreateCollation (CatalogTransaction transaction, SchemaCatalogEntry &schema, CreateCollationInfo &info)
 Creates a collation in the catalog.
 
static DUCKDB_API optional_ptr< CatalogEntryCreateCoordinateSystem (CatalogTransaction transaction, SchemaCatalogEntry &schema, CreateCoordinateSystemInfo &info)
 Creates a coordinate system in the catalog.
 
static DUCKDB_API SchemaCatalogEntryGetSchema (ClientContext &context, const string &catalog_name, const EntryLookupInfo &schema_lookup)
 
static DUCKDB_API optional_ptr< SchemaCatalogEntryGetSchema (ClientContext &context, const string &catalog_name, const EntryLookupInfo &schema_lookup, OnEntryNotFound if_not_found)
 
static DUCKDB_API SchemaCatalogEntryGetSchema (ClientContext &context, const string &catalog_name, const string &schema)
 
static DUCKDB_API optional_ptr< SchemaCatalogEntryGetSchema (ClientContext &context, const string &catalog_name, const string &schema, OnEntryNotFound if_not_found)
 
static DUCKDB_API optional_ptr< SchemaCatalogEntryGetSchema (CatalogEntryRetriever &retriever, const string &catalog_name, const EntryLookupInfo &schema_lookup, OnEntryNotFound if_not_found)
 
static DUCKDB_API optional_ptr< CatalogEntryGetEntry (ClientContext &context, const string &catalog, const string &schema, const EntryLookupInfo &lookup_info, OnEntryNotFound if_not_found)
 
static DUCKDB_API optional_ptr< CatalogEntryGetEntry (CatalogEntryRetriever &retriever, const string &catalog, const string &schema, const EntryLookupInfo &lookup_info, OnEntryNotFound if_not_found)
 
static DUCKDB_API CatalogEntryGetEntry (ClientContext &context, const string &catalog, const string &schema, const EntryLookupInfo &lookup_info)
 
static CatalogEntryGetEntry (ClientContext &context, CatalogType catalog_type, const string &catalog_name, const string &schema_name, const string &name)
 
template<class T >
static optional_ptr< T > GetEntry (ClientContext &context, const string &catalog_name, const string &schema_name, const string &name, OnEntryNotFound if_not_found, QueryErrorContext error_context=QueryErrorContext())
 
template<class T >
static T & GetEntry (ClientContext &context, const string &catalog_name, const string &schema_name, const string &name, QueryErrorContext error_context=QueryErrorContext())
 
static DUCKDB_API vector< reference< SchemaCatalogEntry > > GetSchemas (ClientContext &context, const string &catalog_name)
 
static DUCKDB_API vector< reference< SchemaCatalogEntry > > GetSchemas (CatalogEntryRetriever &retriever, const string &catalog_name)
 
static DUCKDB_API vector< reference< SchemaCatalogEntry > > GetAllSchemas (ClientContext &context)
 
static vector< reference< CatalogEntry > > GetAllEntries (ClientContext &context, CatalogType catalog_type)
 
static CatalogException UnrecognizedConfigurationError (ClientContext &context, const string &name)
 
static String AutoloadExtensionByConfigName (ClientContext &context, const String &configuration_name)
 Autoload the extension required for configuration_name or throw a CatalogException.
 
static bool AutoLoadExtensionByCatalogEntry (DatabaseInstance &db, CatalogType type, const string &entry_name)
 Autoload the extension required for function_name or throw a CatalogException.
 
static DUCKDB_API bool TryAutoLoad (ClientContext &context, const string &extension_name) noexcept
 
- Protected Attributes inherited from duckdb::Catalog
AttachedDatabasedb
 Reference to the database.
 
string default_table
 (optionally) a default table to query for SELECT * FROM <catalog_name>;
 
string default_table_schema
 

Detailed Description

The Catalog object represents the catalog of the database.

Constructor & Destructor Documentation

◆ DuckCatalog()

duckdb::DuckCatalog::DuckCatalog ( AttachedDatabase db)
explicit
26369 : Catalog(db), dependency_manager(make_uniq<DependencyManager>(*this)),
26370 schemas(make_uniq<CatalogSet>(*this, IsSystemCatalog() ? make_uniq<DefaultSchemaGenerator>(*this) : nullptr)) {
26371}
AttachedDatabase & db
Reference to the database.
Definition duckdb.hpp:7405
unique_ptr< DependencyManager > dependency_manager
The DependencyManager manages dependencies between different catalog objects.
Definition duckdb.cpp:22683
unique_ptr< CatalogSet > schemas
The catalog set holding the schemas.
Definition duckdb.cpp:22687

◆ ~DuckCatalog()

duckdb::DuckCatalog::~DuckCatalog ( )
override
26373 {
26374}

Member Function Documentation

◆ IsDuckCatalog()

bool duckdb::DuckCatalog::IsDuckCatalog ( )
overridevirtual

Reimplemented from duckdb::Catalog.

26400 {
26401 return true;
26402}

◆ Initialize()

void duckdb::DuckCatalog::Initialize ( bool  load_builtin)
overridevirtual

Implements duckdb::Catalog.

26376 {
26377 // first initialize the base system catalogs
26378 // these are never written to the WAL
26379 // we start these at 1 because deleted entries default to 0
26380 auto data = CatalogTransaction::GetSystemTransaction(GetDatabase());
26381
26382 // create the default schema
26383 CreateSchemaInfo info;
26384 info.schema = DEFAULT_SCHEMA;
26385 info.internal = true;
26386 info.on_conflict = OnCreateConflict::IGNORE_ON_CONFLICT;
26387 CreateSchema(data, info);
26388
26389 if (load_builtin) {
26390 BuiltinFunctions builtin(data, *this);
26391 builtin.Initialize();
26392
26393 // initialize default functions
26394 FunctionList::RegisterFunctions(*this, data);
26395 }
26396
26397 Verify();
26398}
DUCKDB_API optional_ptr< CatalogEntry > CreateSchema(CatalogTransaction transaction, CreateSchemaInfo &info) override
Creates a schema in the catalog.
Definition duckdb.cpp:26425

◆ GetCatalogType()

string duckdb::DuckCatalog::GetCatalogType ( )
inlineoverridevirtual

Implements duckdb::Catalog.

22620 {
22621 return "duckdb";
22622 }

◆ GetWriteLock()

mutex & duckdb::DuckCatalog::GetWriteLock ( )
inline
22624 {
22625 return write_lock;
22626 }
mutex write_lock
Write lock for the catalog.
Definition duckdb.cpp:22685

◆ SetEncryptionKeyId()

void duckdb::DuckCatalog::SetEncryptionKeyId ( const string &  key_id)
26540 {
26541 encryption_key_id = key_id;
26542}
string encryption_key_id
If is encrypted, store the encryption key_id.
Definition duckdb.cpp:22692

◆ GetEncryptionKeyId()

string & duckdb::DuckCatalog::GetEncryptionKeyId ( )
26544 {
26545 return encryption_key_id;
26546}

◆ SetIsEncrypted()

void duckdb::DuckCatalog::SetIsEncrypted ( )
26548 {
26549 is_encrypted = true;
26550}
bool is_encrypted
Identifies whether the db is encrypted.
Definition duckdb.cpp:22690

◆ GetIsEncrypted()

bool duckdb::DuckCatalog::GetIsEncrypted ( )
26552 {
26553 return is_encrypted;
26554}

◆ CreateSchema()

optional_ptr< CatalogEntry > duckdb::DuckCatalog::CreateSchema ( CatalogTransaction  transaction,
CreateSchemaInfo info 
)
overridevirtual

Creates a schema in the catalog.

Implements duckdb::Catalog.

26425 {
26426 D_ASSERT(!info.schema.empty());
26427 auto result = CreateSchemaInternal(transaction, info);
26428 if (!result) {
26429 switch (info.on_conflict) {
26430 case OnCreateConflict::ERROR_ON_CONFLICT:
26431 throw CatalogException::EntryAlreadyExists(CatalogType::SCHEMA_ENTRY, info.schema);
26432 case OnCreateConflict::REPLACE_ON_CONFLICT: {
26433 DropInfo drop_info;
26434 drop_info.type = CatalogType::SCHEMA_ENTRY;
26435 drop_info.catalog = info.catalog;
26436 drop_info.name = info.schema;
26437 DropSchema(transaction, drop_info);
26438 result = CreateSchemaInternal(transaction, info);
26439 if (!result) {
26440 throw InternalException("Failed to create schema entry in CREATE_OR_REPLACE");
26441 }
26442 break;
26443 }
26444 case OnCreateConflict::IGNORE_ON_CONFLICT:
26445 break;
26446 default:
26447 throw InternalException("Unsupported OnCreateConflict for CreateSchema");
26448 }
26449 return nullptr;
26450 }
26451 return result;
26452}

◆ ScanSchemas() [1/2]

void duckdb::DuckCatalog::ScanSchemas ( ClientContext context,
std::function< void(SchemaCatalogEntry &)>  callback 
)
overridevirtual

Scans all the schemas in the system one-by-one, invoking the callback for each entry.

Implements duckdb::Catalog.

26467 {
26468 schemas->Scan(GetCatalogTransaction(context),
26469 [&](CatalogEntry &entry) { callback(entry.Cast<SchemaCatalogEntry>()); });
26470}

◆ ScanSchemas() [2/2]

void duckdb::DuckCatalog::ScanSchemas ( std::function< void(SchemaCatalogEntry &)>  callback)
26472 {
26473 schemas->Scan([&](CatalogEntry &entry) { callback(entry.Cast<SchemaCatalogEntry>()); });
26474}

◆ LookupSchema()

optional_ptr< SchemaCatalogEntry > duckdb::DuckCatalog::LookupSchema ( CatalogTransaction  transaction,
const EntryLookupInfo schema_lookup,
OnEntryNotFound  if_not_found 
)
overridevirtual

Implements duckdb::Catalog.

26482 {
26483 auto &schema_name = schema_lookup.GetEntryName();
26484 D_ASSERT(!schema_name.empty());
26485 auto entry = schemas->GetEntry(transaction, schema_name);
26486 if (!entry) {
26487 if (if_not_found == OnEntryNotFound::THROW_EXCEPTION) {
26488 throw CatalogException(schema_lookup.GetErrorContext(), "Schema with name %s does not exist!", schema_name);
26489 }
26490 return nullptr;
26491 }
26492 return &entry->Cast<SchemaCatalogEntry>();
26493}

◆ PlanCreateTableAs()

DUCKDB_API PhysicalOperator & duckdb::DuckCatalog::PlanCreateTableAs ( ClientContext context,
PhysicalPlanGenerator planner,
LogicalCreateTable op,
PhysicalOperator plan 
)
overridevirtual

Implements duckdb::Catalog.

◆ PlanInsert()

DUCKDB_API PhysicalOperator & duckdb::DuckCatalog::PlanInsert ( ClientContext context,
PhysicalPlanGenerator planner,
LogicalInsert op,
optional_ptr< PhysicalOperator plan 
)
overridevirtual

Implements duckdb::Catalog.

◆ PlanDelete()

DUCKDB_API PhysicalOperator & duckdb::DuckCatalog::PlanDelete ( ClientContext context,
PhysicalPlanGenerator planner,
LogicalDelete op,
PhysicalOperator plan 
)
overridevirtual

Implements duckdb::Catalog.

◆ PlanUpdate()

DUCKDB_API PhysicalOperator & duckdb::DuckCatalog::PlanUpdate ( ClientContext context,
PhysicalPlanGenerator planner,
LogicalUpdate op,
PhysicalOperator plan 
)
overridevirtual

Implements duckdb::Catalog.

◆ PlanMergeInto()

DUCKDB_API PhysicalOperator & duckdb::DuckCatalog::PlanMergeInto ( ClientContext context,
PhysicalPlanGenerator planner,
LogicalMergeInto op,
PhysicalOperator plan 
)
overridevirtual

Reimplemented from duckdb::Catalog.

◆ BindCreateIndex()

DUCKDB_API unique_ptr< LogicalOperator > duckdb::DuckCatalog::BindCreateIndex ( Binder binder,
CreateStatement stmt,
TableCatalogEntry table,
unique_ptr< LogicalOperator plan 
)
overridevirtual

Reimplemented from duckdb::Catalog.

◆ BindAlterAddIndex()

DUCKDB_API unique_ptr< LogicalOperator > duckdb::DuckCatalog::BindAlterAddIndex ( Binder binder,
TableCatalogEntry table_entry,
unique_ptr< LogicalOperator plan,
unique_ptr< CreateIndexInfo create_info,
unique_ptr< AlterTableInfo alter_info 
)
overridevirtual

Reimplemented from duckdb::Catalog.

◆ GetSchemaCatalogSet()

CatalogSet & duckdb::DuckCatalog::GetSchemaCatalogSet ( )
26476 {
26477 return *schemas;
26478}

◆ GetDatabaseSize()

DatabaseSize duckdb::DuckCatalog::GetDatabaseSize ( ClientContext context)
overridevirtual

Implements duckdb::Catalog.

26495 {
26496 auto &transaction = DuckTransactionManager::Get(db);
26497 auto lock = transaction.SharedCheckpointLock();
26498 return db.GetStorageManager().GetDatabaseSize();
26499}

◆ GetMetadataInfo()

vector< MetadataBlockInfo > duckdb::DuckCatalog::GetMetadataInfo ( ClientContext context)
overridevirtual

Reimplemented from duckdb::Catalog.

26501 {
26502 auto &transaction = DuckTransactionManager::Get(db);
26503 auto lock = transaction.SharedCheckpointLock();
26504 return db.GetStorageManager().GetMetadataInfo();
26505}

◆ InMemory()

bool duckdb::DuckCatalog::InMemory ( )
overridevirtual

Implements duckdb::Catalog.

26507 {
26508 return db.GetStorageManager().InMemory();
26509}

◆ GetDBPath()

string duckdb::DuckCatalog::GetDBPath ( )
overridevirtual

Implements duckdb::Catalog.

26511 {
26512 return db.GetStorageManager().GetDBPath();
26513}
string GetDBPath() const
Returns the database file path.
Definition duckdb.cpp:11140

◆ IsEncrypted()

bool duckdb::DuckCatalog::IsEncrypted ( ) const
overridevirtual

Reimplemented from duckdb::Catalog.

26515 {
26516 return IsSystemCatalog() ? false : db.GetStorageManager().IsEncrypted();
26517}

◆ GetEncryptionCipher()

string duckdb::DuckCatalog::GetEncryptionCipher ( ) const
overridevirtual

Reimplemented from duckdb::Catalog.

26519 {
26520 return IsSystemCatalog() ? string() : EncryptionTypes::CipherToString(db.GetStorageManager().GetCipher());
26521}

◆ GetCatalogVersion()

optional_idx duckdb::DuckCatalog::GetCatalogVersion ( ClientContext context)
overridevirtual

Returns a version number that uniquely characterizes the current catalog snapshot. If there are transaction-local changes, the version returned is >= TRANSACTION_START, o.w. it is a simple number starting at 0 that is incremented at each commit that has had catalog changes. If the catalog does not support versioning, no index is returned.

Reimplemented from duckdb::Catalog.

26530 {
26531 auto &transaction_manager = DuckTransactionManager::Get(db);
26532 auto transaction = GetCatalogTransaction(context);
26533 D_ASSERT(transaction.transaction);
26534 return transaction_manager.GetCatalogVersion(*transaction.transaction);
26535}

◆ GetDependencyManager()

optional_ptr< DependencyManager > duckdb::DuckCatalog::GetDependencyManager ( )
overridevirtual

Returns the dependency manager of this catalog - if the catalog has anye.

Reimplemented from duckdb::Catalog.

26404 {
26405 return dependency_manager.get();
26406}

◆ DropSchema() [1/2]

void duckdb::DuckCatalog::DropSchema ( CatalogTransaction  transaction,
DropInfo info 
)
private
26454 {
26455 D_ASSERT(!info.name.empty());
26456 if (!schemas->DropEntry(transaction, info.name, info.cascade)) {
26457 if (info.if_not_found == OnEntryNotFound::THROW_EXCEPTION) {
26458 throw CatalogException::MissingEntry(CatalogType::SCHEMA_ENTRY, info.name, string());
26459 }
26460 }
26461}

◆ DropSchema() [2/2]

void duckdb::DuckCatalog::DropSchema ( ClientContext context,
DropInfo info 
)
overrideprivatevirtual

Implements duckdb::Catalog.

26463 {
26464 DropSchema(GetCatalogTransaction(context), info);
26465}

◆ CreateSchemaInternal()

optional_ptr< CatalogEntry > duckdb::DuckCatalog::CreateSchemaInternal ( CatalogTransaction  transaction,
CreateSchemaInfo info 
)
private
26411 {
26412 LogicalDependencyList dependencies;
26413
26414 if (!info.internal && DefaultSchemaGenerator::IsDefaultSchema(info.schema)) {
26415 return nullptr;
26416 }
26417 auto entry = make_uniq<DuckSchemaEntry>(*this, info);
26418 auto result = entry.get();
26419 if (!schemas->CreateEntry(transaction, info.schema, std::move(entry), dependencies)) {
26420 return nullptr;
26421 }
26422 return result;
26423}

◆ Verify()

void duckdb::DuckCatalog::Verify ( )
overrideprivatevirtual

Reimplemented from duckdb::Catalog.

26523 {
26524#ifdef DEBUG
26525 Catalog::Verify();
26526 schemas->Verify(*this);
26527#endif
26528}

The documentation for this class was generated from the following file: