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::TableCatalogEntry Class Referenceabstract

A table catalog entry. More...

Inheritance diagram for duckdb::TableCatalogEntry:
Collaboration diagram for duckdb::TableCatalogEntry:

Public Member Functions

DUCKDB_API TableCatalogEntry (Catalog &catalog, SchemaCatalogEntry &schema, CreateTableInfo &info)
 Create a TableCatalogEntry and initialize storage for it.
 
DUCKDB_API unique_ptr< CreateInfoGetInfo () const override
 
DUCKDB_API bool HasGeneratedColumns () const
 
DUCKDB_API bool ColumnExists (const string &name) const
 Returns whether or not a column with the given name exists.
 
DUCKDB_API const ColumnDefinitionGetColumn (const string &name) const
 
DUCKDB_API const ColumnDefinitionGetColumn (LogicalIndex idx) const
 
DUCKDB_API vector< LogicalTypeGetTypes () const
 Returns a list of types of the table, excluding generated columns.
 
DUCKDB_API const ColumnListGetColumns () const
 Returns a list of the columns of the table.
 
virtual DataTableGetStorage ()
 Returns the underlying storage of the table.
 
DUCKDB_API const vector< unique_ptr< Constraint > > & GetConstraints () const
 Returns a list of the constraints of the table.
 
DUCKDB_API string ToSQL () const override
 Convert the catalog entry to a SQL string that can be used to re-construct the catalog entry.
 
virtual unique_ptr< BaseStatisticsGetStatistics (ClientContext &context, column_t column_id)=0
 Get statistics of a column (physical or virtual) within the table.
 
virtual unique_ptr< BlockingSampleGetSample ()
 
DUCKDB_API LogicalIndex GetColumnIndex (string &name, bool if_exists=false) const
 
DUCKDB_API StorageIndex GetStorageIndex (const ColumnIndex &column_index) const
 
virtual TableFunction GetScanFunction (ClientContext &context, unique_ptr< FunctionData > &bind_data)=0
 Returns the scan function that can be used to scan the given table.
 
virtual TableFunction GetScanFunction (ClientContext &context, unique_ptr< FunctionData > &bind_data, const EntryLookupInfo &lookup_info)
 
virtual bool IsDuckTable () const
 
virtual vector< ColumnSegmentInfoGetColumnSegmentInfo (const QueryContext &context)
 Returns a list of segment information for this table, if exists.
 
virtual TableStorageInfo GetStorageInfo (ClientContext &context)=0
 Returns the storage info of this table.
 
virtual void BindUpdateConstraints (Binder &binder, LogicalGet &get, LogicalProjection &proj, LogicalUpdate &update, ClientContext &context)
 
optional_ptr< ConstraintGetPrimaryKey () const
 Returns a pointer to the table's primary key, if exists, else nullptr.
 
bool HasPrimaryKey () const
 Returns true, if the table has a primary key, else false.
 
virtual virtual_column_map_t GetVirtualColumns () const
 Returns the virtual columns for this table.
 
virtual vector< column_tGetRowIdColumns () const
 
- Public Member Functions inherited from duckdb::StandardEntry
 StandardEntry (CatalogType type, SchemaCatalogEntry &schema, Catalog &catalog, string name)
 
SchemaCatalogEntryParentSchema () override
 
const SchemaCatalogEntryParentSchema () const override
 
- Public Member Functions inherited from duckdb::InCatalogEntry
 InCatalogEntry (CatalogType type, Catalog &catalog, string name)
 
CatalogParentCatalog () override
 
const CatalogParentCatalog () const override
 
void Verify (Catalog &catalog) override
 
- Public Member Functions inherited from duckdb::CatalogEntry
 CatalogEntry (CatalogType type, Catalog &catalog, string name)
 
 CatalogEntry (CatalogType type, string name, idx_t oid)
 
virtual unique_ptr< CatalogEntryAlterEntry (ClientContext &context, AlterInfo &info)
 
virtual unique_ptr< CatalogEntryAlterEntry (CatalogTransaction transaction, AlterInfo &info)
 
virtual void UndoAlter (ClientContext &context, AlterInfo &info)
 
virtual void Rollback (CatalogEntry &prev_entry)
 
virtual void OnDrop ()
 
virtual unique_ptr< CatalogEntryCopy (ClientContext &context) const
 
virtual void SetAsRoot ()
 Sets the CatalogEntry as the new root entry (i.e. the newest entry)
 
void Serialize (Serializer &serializer) const
 
void SetChild (unique_ptr< CatalogEntry > child)
 
unique_ptr< CatalogEntryTakeChild ()
 
bool HasChild () const
 
bool HasParent () const
 
CatalogEntryChild ()
 
CatalogEntryParent ()
 
const CatalogEntryParent () const
 
template<class TARGET >
TARGETCast ()
 
template<class TARGET >
const TARGETCast () const
 

Static Public Member Functions

static DUCKDB_API string ColumnsToSQL (const ColumnList &columns, const vector< unique_ptr< Constraint > > &constraints)
 
static string ColumnNamesToSQL (const ColumnList &columns)
 Returns the expression string list of the column names e.g. (col1, col2, col3)
 
- Static Public Member Functions inherited from duckdb::CatalogEntry
static unique_ptr< CreateInfoDeserialize (Deserializer &deserializer)
 

Static Public Attributes

static constexpr const CatalogType Type = CatalogType::TABLE_ENTRY
 
static constexpr const charName = "table"
 

Protected Attributes

ColumnList columns
 A list of columns that are part of this table.
 
vector< unique_ptr< Constraint > > constraints
 A list of constraints that are part of this table.
 

Additional Inherited Members

- Public Attributes inherited from duckdb::StandardEntry
SchemaCatalogEntryschema
 The schema the entry belongs to.
 
LogicalDependencyList dependencies
 The dependencies of the entry, can be empty.
 
- Public Attributes inherited from duckdb::InCatalogEntry
Catalogcatalog
 The catalog the entry belongs to.
 
- Public Attributes inherited from duckdb::CatalogEntry
idx_t oid
 The oid of the entry.
 
CatalogType type
 The type of this catalog entry.
 
optional_ptr< CatalogSetset
 Reference to the catalog set this entry is stored in.
 
string name
 The name of the entry.
 
bool deleted
 Whether or not the object is deleted.
 
bool temporary
 Whether or not the object is temporary and should not be added to the WAL.
 
bool internal
 Whether or not the entry is an internal entry (cannot be deleted, not dumped, etc)
 
atomic< transaction_ttimestamp
 Timestamp at which the catalog entry was created.
 
Value comment
 (optional) comment on this entry
 
InsertionOrderPreservingMap< string > tags
 (optional) extra data associated with this entry
 

Detailed Description

A table catalog entry.

Constructor & Destructor Documentation

◆ TableCatalogEntry()

duckdb::TableCatalogEntry::TableCatalogEntry ( Catalog catalog,
SchemaCatalogEntry schema,
CreateTableInfo info 
)

Create a TableCatalogEntry and initialize storage for it.

20903 : StandardEntry(CatalogType::TABLE_ENTRY, schema, catalog, info.table), columns(std::move(info.columns)),
20904 constraints(std::move(info.constraints)) {
20905 this->temporary = info.temporary;
20906 this->dependencies = info.dependencies;
20907 this->comment = info.comment;
20908 this->tags = info.tags;
20909}
InsertionOrderPreservingMap< string > tags
(optional) extra data associated with this entry
Definition duckdb.hpp:6323
Value comment
(optional) comment on this entry
Definition duckdb.hpp:6321
bool temporary
Whether or not the object is temporary and should not be added to the WAL.
Definition duckdb.hpp:6315
Catalog & catalog
The catalog the entry belongs to.
Definition duckdb.hpp:6387
SchemaCatalogEntry & schema
The schema the entry belongs to.
Definition duckdb.hpp:28008
LogicalDependencyList dependencies
The dependencies of the entry, can be empty.
Definition duckdb.hpp:28010
ColumnList columns
A list of columns that are part of this table.
Definition duckdb.cpp:2813
vector< unique_ptr< Constraint > > constraints
A list of constraints that are part of this table.
Definition duckdb.cpp:2815

Member Function Documentation

◆ GetInfo()

unique_ptr< CreateInfo > duckdb::TableCatalogEntry::GetInfo ( ) const
overridevirtual

Reimplemented from duckdb::CatalogEntry.

20966 {
20967 auto result = make_uniq<CreateTableInfo>();
20968 result->catalog = catalog.GetName();
20969 result->schema = schema.name;
20970 result->table = name;
20971 result->columns = columns.Copy();
20972 result->constraints.reserve(constraints.size());
20973 result->dependencies = dependencies;
20974 std::for_each(constraints.begin(), constraints.end(),
20975 [&result](const unique_ptr<Constraint> &c) { result->constraints.emplace_back(c->Copy()); });
20976 result->temporary = temporary;
20977 result->internal = internal;
20978 result->comment = comment;
20979 result->tags = tags;
20980 return std::move(result);
20981}
string name
The name of the entry.
Definition duckdb.hpp:6311
bool internal
Whether or not the entry is an internal entry (cannot be deleted, not dumped, etc)
Definition duckdb.hpp:6317
DUCKDB_API const string & GetName() const
Returns the catalog name - based on how the catalog was attached.
Definition duckdb.cpp:7165

◆ HasGeneratedColumns()

bool duckdb::TableCatalogEntry::HasGeneratedColumns ( ) const
20911 {
20912 return columns.LogicalColumnCount() != columns.PhysicalColumnCount();
20913}

◆ ColumnExists()

bool duckdb::TableCatalogEntry::ColumnExists ( const string &  name) const

Returns whether or not a column with the given name exists.

20950 {
20951 return columns.ColumnExists(name);
20952}

◆ GetColumn() [1/2]

const ColumnDefinition & duckdb::TableCatalogEntry::GetColumn ( const string &  name) const

Returns a reference to the column of the specified name. Throws an exception if the column does not exist.

20954 {
20955 return columns.GetColumn(name);
20956}

◆ GetColumn() [2/2]

const ColumnDefinition & duckdb::TableCatalogEntry::GetColumn ( LogicalIndex  idx) const

Returns a reference to the column of the specified logical index. Throws an exception if the column does not exist.

21125 {
21126 return columns.GetColumn(idx);
21127}

◆ GetTypes()

vector< LogicalType > duckdb::TableCatalogEntry::GetTypes ( ) const

Returns a list of types of the table, excluding generated columns.

20958 {
20959 vector<LogicalType> types;
20960 for (auto &col : columns.Physical()) {
20961 types.push_back(col.Type());
20962 }
20963 return types;
20964}

◆ GetColumns()

const ColumnList & duckdb::TableCatalogEntry::GetColumns ( ) const

Returns a list of the columns of the table.

21121 {
21122 return columns;
21123}

◆ GetStorage()

DataTable & duckdb::TableCatalogEntry::GetStorage ( )
virtual

Returns the underlying storage of the table.

Reimplemented in duckdb::DuckTableEntry.

21134 {
21135 throw InternalException("Calling GetStorage on a TableCatalogEntry that is not a DuckTableEntry");
21136}
Here is the caller graph for this function:

◆ GetConstraints()

const vector< unique_ptr< Constraint > > & duckdb::TableCatalogEntry::GetConstraints ( ) const

Returns a list of the constraints of the table.

21129 {
21130 return constraints;
21131}
Here is the caller graph for this function:

◆ ToSQL()

string duckdb::TableCatalogEntry::ToSQL ( ) const
overridevirtual

Convert the catalog entry to a SQL string that can be used to re-construct the catalog entry.

Reimplemented from duckdb::CatalogEntry.

21111 {
21112 auto create_info = GetInfo();
21113 return create_info->ToString();
21114}

◆ GetStatistics()

virtual unique_ptr< BaseStatistics > duckdb::TableCatalogEntry::GetStatistics ( ClientContext context,
column_t  column_id 
)
pure virtual

Get statistics of a column (physical or virtual) within the table.

Implemented in duckdb::DuckTableEntry.

◆ GetSample()

unique_ptr< BlockingSample > duckdb::TableCatalogEntry::GetSample ( )
virtual
20946 {
20947 return nullptr;
20948}

◆ GetColumnIndex()

LogicalIndex duckdb::TableCatalogEntry::GetColumnIndex ( string &  name,
bool  if_exists = false 
) const

Returns the column index of the specified column name. If the column does not exist: If if_column_exists is true, returns DConstants::INVALID_INDEX If if_column_exists is false, throws an exception

20929 {
20930 auto entry = columns.GetColumnIndex(column_name);
20931 if (!entry.IsValid()) {
20932 if (if_exists) {
20933 return entry;
20934 }
20935 vector<string> column_names;
20936 for (auto &col : columns.Logical()) {
20937 column_names.push_back(col.Name());
20938 }
20939 auto candidates = StringUtil::CandidatesErrorMessage(column_names, column_name, "Did you mean");
20940 throw BinderException("Table \"%s\" does not have a column with name \"%s\"\n%s", name, column_name,
20941 candidates);
20942 }
20943 return entry;
20944}
static DUCKDB_API string CandidatesErrorMessage(const vector< string > &strings, const string &target, const string &message_prefix, idx_t n=5)
Here is the call graph for this function:

◆ GetStorageIndex()

StorageIndex duckdb::TableCatalogEntry::GetStorageIndex ( const ColumnIndex column_index) const
20915 {
20916 if (column_id.IsRowIdColumn()) {
20917 return StorageIndex(COLUMN_IDENTIFIER_ROW_ID);
20918 }
20919
20920 // The index of the base ColumnIndex is equal to the physical column index in the table
20921 // for any child indices because the indices are already the physical indices.
20922 // Only the top-level can have generated columns.
20923 auto &col = GetColumn(column_id.ToLogical());
20924 auto result = StorageIndex::FromColumnIndex(column_id);
20925 result.SetIndex(col.StorageOid());
20926 return result;
20927}
DUCKDB_API const ColumnDefinition & GetColumn(const string &name) const
Definition duckdb.cpp:20954
const column_t COLUMN_IDENTIFIER_ROW_ID
Special value used to signify the ROW ID of a table.
Definition duckdb.cpp:50303

◆ GetScanFunction() [1/2]

virtual TableFunction duckdb::TableCatalogEntry::GetScanFunction ( ClientContext context,
unique_ptr< FunctionData > &  bind_data 
)
pure virtual

Returns the scan function that can be used to scan the given table.

Implemented in duckdb::DuckTableEntry.

◆ GetScanFunction() [2/2]

TableFunction duckdb::TableCatalogEntry::GetScanFunction ( ClientContext context,
unique_ptr< FunctionData > &  bind_data,
const EntryLookupInfo lookup_info 
)
virtual
21117 {
21118 return GetScanFunction(context, bind_data);
21119}
virtual TableFunction GetScanFunction(ClientContext &context, unique_ptr< FunctionData > &bind_data)=0
Returns the scan function that can be used to scan the given table.

◆ IsDuckTable()

virtual bool duckdb::TableCatalogEntry::IsDuckTable ( ) const
inlinevirtual
2783 {
2784 return false;
2785 }

◆ ColumnsToSQL()

string duckdb::TableCatalogEntry::ColumnsToSQL ( const ColumnList columns,
const vector< unique_ptr< Constraint > > &  constraints 
)
static
20983 {
20985
20986 ss << "(";
20987
20988 // find all columns that have NOT NULL specified, but are NOT primary key columns
20989 logical_index_set_t not_null_columns;
20990 logical_index_set_t unique_columns;
20991 logical_index_set_t pk_columns;
20992 unordered_set<string> multi_key_pks;
20993 vector<string> extra_constraints;
20994 for (auto &constraint : constraints) {
20995 if (constraint->type == ConstraintType::NOT_NULL) {
20996 auto &not_null = constraint->Cast<NotNullConstraint>();
20997 not_null_columns.insert(not_null.index);
20998 } else if (constraint->type == ConstraintType::UNIQUE) {
20999 auto &pk = constraint->Cast<UniqueConstraint>();
21000 if (pk.HasIndex()) {
21001 // no columns specified: single column constraint
21002 if (pk.IsPrimaryKey()) {
21003 pk_columns.insert(pk.GetIndex());
21004 } else {
21005 unique_columns.insert(pk.GetIndex());
21006 }
21007 } else {
21008 // multi-column constraint, this constraint needs to go at the end after all columns
21009 if (pk.IsPrimaryKey()) {
21010 // multi key pk column: insert set of columns into multi_key_pks
21011 for (auto &col : pk.GetColumnNames()) {
21012 multi_key_pks.insert(col);
21013 }
21014 }
21015 extra_constraints.push_back(constraint->ToString());
21016 }
21017 } else if (constraint->type == ConstraintType::FOREIGN_KEY) {
21018 auto &fk = constraint->Cast<ForeignKeyConstraint>();
21019 if (fk.info.type == ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE ||
21020 fk.info.type == ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE) {
21021 extra_constraints.push_back(constraint->ToString());
21022 }
21023 } else {
21024 extra_constraints.push_back(constraint->ToString());
21025 }
21026 }
21027
21028 for (auto &column : columns.Logical()) {
21029 if (column.Oid() > 0) {
21030 ss << ", ";
21031 }
21032 ss << KeywordHelper::WriteOptionallyQuoted(column.Name()) << " ";
21033 auto &column_type = column.Type();
21034 if (column_type.id() != LogicalTypeId::ANY) {
21035 ss << column.Type().ToString();
21036 }
21037 auto extra_type_info = column_type.AuxInfo();
21038 if (extra_type_info) {
21039 if (extra_type_info->type == ExtraTypeInfoType::STRING_TYPE_INFO) {
21040 auto &string_info = extra_type_info->Cast<StringTypeInfo>();
21041 if (!string_info.collation.empty()) {
21042 ss << " COLLATE " + string_info.collation;
21043 }
21044 }
21045 if (extra_type_info->type == ExtraTypeInfoType::UNBOUND_TYPE_INFO) {
21046 // TODO
21047 // auto &colllation = UnboundType::GetCollation(column_type);
21048 // if (!colllation.empty()) {
21049 // ss << " COLLATE " + colllation;
21050 //}
21051 }
21052 }
21053 bool not_null = not_null_columns.find(column.Logical()) != not_null_columns.end();
21054 bool is_single_key_pk = pk_columns.find(column.Logical()) != pk_columns.end();
21055 bool is_multi_key_pk = multi_key_pks.find(column.Name()) != multi_key_pks.end();
21056 bool is_unique = unique_columns.find(column.Logical()) != unique_columns.end();
21057 if (column.Generated()) {
21058 reference<const ParsedExpression> generated_expression = column.GeneratedExpression();
21059 if (column_type.id() != LogicalTypeId::ANY) {
21060 // We artificially add a cast if the type is specified, need to strip it
21061 auto &expr = generated_expression.get();
21062 D_ASSERT(expr.GetExpressionType() == ExpressionType::OPERATOR_CAST);
21063 auto &cast_expr = expr.Cast<CastExpression>();
21064 generated_expression = *cast_expr.child;
21065 }
21066 ss << " GENERATED ALWAYS AS(" << generated_expression.get().ToString() << ")";
21067 } else if (column.HasDefaultValue()) {
21068 ss << " DEFAULT(" << column.DefaultValue().ToString() << ")";
21069 }
21070 if (not_null && !is_single_key_pk && !is_multi_key_pk) {
21071 // NOT NULL but not a primary key column
21072 ss << " NOT NULL";
21073 }
21074 if (is_single_key_pk) {
21075 // single column pk: insert constraint here
21076 ss << " PRIMARY KEY";
21077 }
21078 if (is_unique) {
21079 // single column unique: insert constraint here
21080 ss << " UNIQUE";
21081 }
21082 }
21083 // print any extra constraints that still need to be printed
21084 for (auto &extra_constraint : extra_constraints) {
21085 ss << ", ";
21086 ss << extra_constraint;
21087 }
21088
21089 ss << ")";
21090 return ss.str();
21091}
static string WriteOptionallyQuoted(const string &text, char quote='"', bool allow_caps = true, KeywordCategory category = KeywordCategory::KEYWORD_NONE)
Writes a string that is optionally quoted + escaped so it can be used as an identifier.
Definition duckdb.hpp:960

◆ ColumnNamesToSQL()

string duckdb::TableCatalogEntry::ColumnNamesToSQL ( const ColumnList columns)
static

Returns the expression string list of the column names e.g. (col1, col2, col3)

21093 {
21094 if (columns.empty()) {
21095 return "";
21096 }
21097
21099 ss << "(";
21100
21101 for (auto &column : columns.Logical()) {
21102 if (column.Oid() > 0) {
21103 ss << ", ";
21104 }
21105 ss << KeywordHelper::WriteOptionallyQuoted(column.Name()) << " ";
21106 }
21107 ss << ")";
21108 return ss.str();
21109}
Here is the call graph for this function:

◆ GetColumnSegmentInfo()

vector< ColumnSegmentInfo > duckdb::TableCatalogEntry::GetColumnSegmentInfo ( const QueryContext context)
virtual

Returns a list of segment information for this table, if exists.

Reimplemented in duckdb::DuckTableEntry.

21173 {
21174 return {};
21175}

◆ GetStorageInfo()

virtual TableStorageInfo duckdb::TableCatalogEntry::GetStorageInfo ( ClientContext context)
pure virtual

Returns the storage info of this table.

Implemented in duckdb::DuckTableEntry.

◆ BindUpdateConstraints()

void duckdb::TableCatalogEntry::BindUpdateConstraints ( Binder binder,
LogicalGet get,
LogicalProjection proj,
LogicalUpdate update,
ClientContext context 
)
virtual
21178 {
21179 // check the constraints and indexes of the table to see if we need to project any additional columns
21180 // we do this for indexes with multiple columns and CHECK constraints in the UPDATE clause
21181 // suppose we have a constraint CHECK(i + j < 10); now we need both i and j to check the constraint
21182 // if we are only updating one of the two columns we add the other one to the UPDATE set
21183 // with a "useless" update (i.e. i=i) so we can verify that the CHECK constraint is not violated
21184 auto bound_constraints = binder.BindConstraints(constraints, name, columns);
21185 for (auto &constraint : bound_constraints) {
21186 if (constraint->type == ConstraintType::CHECK) {
21187 auto &check = constraint->Cast<BoundCheckConstraint>();
21188 // check constraint! check if we need to add any extra columns to the UPDATE clause
21189 LogicalUpdate::BindExtraColumns(*this, get, proj, update, check.bound_columns);
21190 }
21191 }
21192 if (update.return_chunk) {
21193 physical_index_set_t all_columns;
21194 for (auto &column : GetColumns().Physical()) {
21195 all_columns.insert(column.Physical());
21196 }
21197 LogicalUpdate::BindExtraColumns(*this, get, proj, update, all_columns);
21198 }
21199 // for index updates we always turn any update into an insert and a delete
21200 // we thus need all the columns to be available, hence we check if the update touches any index columns
21201 // If the returning keyword is used, we need access to the whole row in case the user requests it.
21202 // Therefore switch the update to a delete and insert.
21203 update.update_is_del_and_insert = false;
21204 TableStorageInfo table_storage_info = GetStorageInfo(context);
21205 for (auto index : table_storage_info.index_info) {
21206 for (auto &column : update.columns) {
21207 if (index.column_set.find(column.index) != index.column_set.end()) {
21208 update.update_is_del_and_insert = true;
21209 break;
21210 }
21211 }
21212 }
21213
21214 // we also convert any updates on LIST columns into delete + insert
21215 for (auto &col_index : update.columns) {
21216 auto &column = GetColumns().GetColumn(col_index);
21217 if (!column.Type().SupportsRegularUpdate()) {
21218 update.update_is_del_and_insert = true;
21219 break;
21220 }
21221 }
21222
21223 if (update.update_is_del_and_insert) {
21224 // the update updates a column required by an index or requires returning the updated rows,
21225 // push projections for all columns
21226 physical_index_set_t all_columns;
21227 for (auto &column : GetColumns().Physical()) {
21228 all_columns.insert(column.Physical());
21229 }
21230 LogicalUpdate::BindExtraColumns(*this, get, proj, update, all_columns);
21231 }
21232}
DUCKDB_API const ColumnList & GetColumns() const
Returns a list of the columns of the table.
Definition duckdb.cpp:21121
virtual TableStorageInfo GetStorageInfo(ClientContext &context)=0
Returns the storage info of this table.
__host__ cudaTextureObject_t get() const noexcept
index

◆ GetPrimaryKey()

optional_ptr< Constraint > duckdb::TableCatalogEntry::GetPrimaryKey ( ) const

Returns a pointer to the table's primary key, if exists, else nullptr.

21234 {
21235 for (const auto &constraint : GetConstraints()) {
21236 if (constraint->type == ConstraintType::UNIQUE) {
21237 auto &unique = constraint->Cast<UniqueConstraint>();
21238 if (unique.IsPrimaryKey()) {
21239 return &unique;
21240 }
21241 }
21242 }
21243 return nullptr;
21244}
DUCKDB_API const vector< unique_ptr< Constraint > > & GetConstraints() const
Returns a list of the constraints of the table.
Definition duckdb.cpp:21129
Here is the call graph for this function:
Here is the caller graph for this function:

◆ HasPrimaryKey()

bool duckdb::TableCatalogEntry::HasPrimaryKey ( ) const

Returns true, if the table has a primary key, else false.

21246 {
21247 return GetPrimaryKey() != nullptr;
21248}
optional_ptr< Constraint > GetPrimaryKey() const
Returns a pointer to the table's primary key, if exists, else nullptr.
Definition duckdb.cpp:21234
Here is the call graph for this function:

◆ GetVirtualColumns()

virtual_column_map_t duckdb::TableCatalogEntry::GetVirtualColumns ( ) const
virtual

Returns the virtual columns for this table.

21250 {
21251 virtual_column_map_t virtual_columns;
21252 virtual_columns.insert(make_pair(COLUMN_IDENTIFIER_ROW_ID, TableColumn("rowid", LogicalType::ROW_TYPE)));
21253 return virtual_columns;
21254}

◆ GetRowIdColumns()

vector< column_t > duckdb::TableCatalogEntry::GetRowIdColumns ( ) const
virtual
21256 {
21257 vector<column_t> result;
21258 result.push_back(COLUMN_IDENTIFIER_ROW_ID);
21259 return result;
21260}

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