# Functions

CheckColumnType verifies that a given value is compatible with the type requested by the column.
CheckValueWidth checks that the width (for strings, byte arrays, and bit string) and scale (for decimals) of the value fits the specified column type.
ColIDtoRowIndexFromCols groups a slice of ColumnDescriptors by their ID field, returning a map from ID to ColumnDescriptor.
ColTypeInfoFromColDescs creates a ColTypeInfo from []ColumnDescriptor.
ColTypeInfoFromColTypes creates a ColTypeInfo from []ColumnType.
ColTypeInfoFromResCols creates a ColTypeInfo from ResultColumns.
ColumnsSelectors generates Select expressions for cols.
CompareDatums compares two datum rows according to a column ordering.
ConvertBatchError returns a user friendly constraint violation error.
DatumToEncDatum initializes an EncDatum with the given Datum.
DatumTypeToColumnSemanticType converts a parser.Type to a SemanticType.
DatumTypeToColumnType converts a parser Type to a ColumnType.
DecodeIndexKey decodes the values that are a part of the specified index key.
DecodeIndexKeyPrefix decodes the prefix of an index key and returns the index id and a slice for the rest of the key.
DecodeKeyVals decodes the values that are part of the key.
DecodeTableIDIndexID decodes a table id followed by an index id.
DecodeTableKey decodes a table key/value.
DecodeTableValue decodes a value encoded by EncodeTableValue.
EncDatumFromBuffer initializes an EncDatum with an encoding that is possibly followed by other data.
EncDatumFromEncoded initializes an EncDatum with the given encoded value.
EncDatumRowToDatums converts a given EncDatumRow to a Datums.
EncodeColumns is a version of EncodePartialIndexKey that takes ColumnIDs and directions explicitly.
EncodeDatum encodes a datum (order-preserving encoding, suitable for keys).
EncodeDatums encodes a Datums (order-preserving).
EncodeIndexKey creates a key by concatenating keyPrefix with the encodings of the columns in the index.
EncodePartialIndexKey encodes a partial index key; only the first numCols of index.ColumnIDs are encoded.
EncodeSecondaryIndex encodes key/values for a secondary index.
EncodeSecondaryIndexes encodes key/values for the secondary indexes.
EncodeTableKey encodes `val` into `b` and returns the new buffer.
EncodeTableValue encodes `val` into `appendTo` using DatumEncoding_VALUE and returns the new buffer.
EncodingDirToDatumEncoding returns an equivalent DatumEncoding for the given encoding direction.
ExtractIndexKey constructs the index (primary) key for a row from any index key/value entry, including secondary indexes.
FixedOffsetTimeZoneToLocation creates a time.Location with a set offset and with a name that can be marshalled by crdb between nodes.
GetDatabaseDescFromID retrieves the database descriptor for the database ID passed in using an existing txn.
GetTableDescFromID retrieves the table descriptor for the table ID passed in using an existing txn.
GetTableDescriptor retrieves a table descriptor directly from the KV layer.
HasCompositeKeyEncoding returns true if key columns of the given kind can have a composite encoding.
IsPermanentSchemaChangeError returns true if the error results in a permanent failure of a schema change.
IsQueryCanceledError checks whether this is a query canceled error.
IsReservedID returns whether this ID is for any system object.
IsSystemConfigID returns whether this ID is for a system config object.
IsUndefinedDatabaseError returns true if the error is for an undefined database.
IsUndefinedRelationError returns true if the error is for an undefined table.
IsUniquenessConstraintViolationError returns true if the error is for a uniqueness constraint violation.
MakeAllDescsMetadataKey returns the key for all descriptors.
MakeColumnDefDescs creates the column descriptor for a column, as well as the index descriptor if the column is a primary key or unique.
MakeDefaultExprs returns a slice of the default expressions for the slice of input column descriptors, or nil if none of the input column descriptors have default expressions.
MakeDescMetadataKey returns the key for the descriptor.
MakeEncodedKeyVals returns a slice of EncDatums with the correct types for the given columns.
MakeIndexKeyPrefix returns the key prefix used for the index's data.
MakeKeyFromEncDatums creates a key by concatenating keyPrefix with the encodings of the given EncDatum values.
MakeMetadataSchema constructs a new MetadataSchema value which constructs the "system" database.
MakeNameMetadataKey returns the key for the name.
MakePrimaryIndexKey creates a key prefix that corresponds to a table row (in the primary index); it is intended for tests.
MakeRowDeleter creates a RowDeleter for the given table.
MakeRowInserter creates a RowInserter for the given table.
MakeRowUpdater creates a RowUpdater for the given table.
MakeZoneKey returns the key for 'id's entry in the system.zones table.
MakeZoneKeyPrefix returns the key prefix for the 'id's row in the system.zones table.
MarshalColumnValue returns a Go primitive value equivalent of val, of the type expected by col.
MustBeValueEncoded returns true if columns of the given kind can only be value encoded.
NewCancelChecker returns a new CancelChecker.
NewDatabaseAlreadyExistsError creates an error for a preexisting database.
NewDefaultPrivilegeDescriptor returns a privilege descriptor with ALL privileges for the root user.
NewDependentObjectError creates a dependent object error.
NewDependentObjectErrorWithHint creates a dependent object error with a hint.
NewInvalidSchemaDefinitionError creates an error for an invalid schema definition such as a schema definition that doesn't parse.
NewNonNullViolationError creates an error for a violation of a non-NULL constraint.
NewPrivilegeDescriptor returns a privilege descriptor for the given user with the specified list of privileges.
NewQueryCanceledError creates a query cancellation error.
NewRangeUnavailableError creates an unavailable range error.
NewRelationAlreadyExistsError creates an error for a preexisting relation.
NewRetryError creates an error signifying that the transaction can be retried.
NewRowContainer allocates a new row container.
NewStatementCompletionUnknownError creates an error with the corresponding pg code.
NewSyntaxError creates a syntax error.
NewTransactionAbortedError creates an error for trying to run a command in the context of transaction that's already aborted.
NewTransactionCommittedError creates an error that signals that the SQL txn is in the COMMIT_WAIT state and that only a COMMIT statement will be accepted.
NewUndefinedDatabaseError creates an error that represents a missing database.
NewUndefinedRelationError creates an error that represents a missing database table or view.
NewUniquenessConstraintViolationError creates an error that represents a violation of a UNIQUE constraint.
NewWindowingError creates a windowing error.
NewWrongObjectTypeError creates a wrong object type error.
ParseFixedOffsetTimeZone takes the string representation of a time.Location created by FixedOffsetTimeZoneToLocation and parses it to the offset and the original representation specified by the user.
PrettyKey pretty-prints the specified key, skipping over the first `skip` fields.
PrettySpan returns a human-readable representation of a span.
PrettySpans returns a human-readable description of the spans.
ProcessDefaultColumns adds columns with DEFAULT to cols if not present and returns the defaultExprs for cols.
RandCollationLocale returns a random element of collationLocales.
RandColumnType returns a random ColumnType value.
RandColumnTypes returns a slice of numCols random ColumnType value.
RandDatum generates a random Datum of the given type.
RandDatumEncoding returns a random DatumEncoding value.
RandEncDatum generates a random EncDatum (of a random type).
RandEncDatumRowOfTypes generates a slice of random EncDatum values for the corresponding type in types.
RandEncDatumRows generates EncDatumRows where all rows follow the same random []ColumnType structure.
RandEncDatumRowsOfTypes generates EncDatumRows, each row with values of the corresponding type in types.
RandEncDatumSlice generates a slice of random EncDatum values of the same random type.
RandEncDatumSlices generates EncDatum slices, each slice with values of the same random type.
ResultColumnsFromColDescs converts ColumnDescriptors to ResultColumns.
RunFilter runs a filter expression and returns whether the filter passes.
SanitizeVarFreeExpr verifies that an expression is valid, has the correct type and contains no variable expressions.
SetKVBatchSize changes the kvFetcher batch size, and returns a function that restores it.
Sort sorts data.
SystemDesiredPrivileges returns the desired privilege list (i.e., the privilege list with which the object should be created with in a fresh cluster) for a given system object ID.
TablesNeededForFKs calculates the IDs of the additional TableDescriptors that will be needed for FK checking delete and/or insert operations on `table`.
TimeZoneStringToLocation transforms a string into a time.Location.
UnmarshalColumnValue decodes the value from a key-value pair using the type expected by the column.
WrapDescriptor fills in a Descriptor.

# Constants

BaseFormatVersion corresponds to the encoding described in https://www.cockroachlabs.com/blog/sql-in-cockroachdb-mapping-table-data-to-key-value-storage/.
CheckDeletes checks if rows reference a changed value.
CheckFKs can be passed to row writers to check fk validity.
CheckInserts checks if a new/changed value references an existing row.
CheckUpdates checks all references (CheckDeletes+CheckInserts).
CodeRangeUnavailable signals that some data from the cluster cannot be accessed (e.g.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NULL is not supported as a table column type, however it can be transferred through distsql streams.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ConstraintTypeCheck identifies a CHECK constraint.
ConstraintTypeFK identifies a FOREIGN KEY constraint.
ConstraintTypePK identifies a PRIMARY KEY constraint.
ConstraintTypeUnique identifies a FOREIGN constraint.
No description provided by the author
No description provided by the author
Indicates that the datum is encoded using the order-preserving encoding used for keys (ascending order).
Indicates that the datum is encoded using the order-preserving encoding used for keys (descending order).
Indicates that the datum is encoded using the encoding used for values.
Descriptor is being added.
Operations can use this invisible descriptor to implicitly write and delete entries.
Operations can use this invisible descriptor to implicitly delete entries.
Descriptor is being dropped.
Not used.
Not used.
These system tables are part of the system config.
These system tables are not part of the system config.
FamilyFormatVersion corresponds to the encoding described in https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/sql_column_families.md.
FamilyHeuristicTargetBytes is the target total byte size of columns that the current heuristic will assign to a family.
No description provided by the author
No description provided by the author
InterleavedFormatVersion corresponds to the encoding described in https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/sql_interleaved_tables.md.
InvalidID is the uninitialised descriptor id.
InvalidMutationID is the uninitialised mutation id.
These system tables are not part of the system config.
These system tables are not part of the system config.
These system tables are part of the system config.
PrimaryKeyIndexName is the name of the index for the primary key.
rangelog is currently envisioned as a wide table; many different event types can be recorded to the table.
RowUpdaterDefault indicates that a RowUpdater should update everything about a row, including secondary indexes.
RowUpdaterOnlyColumns indicates that a RowUpdater should only update the columns of a row.
These system tables are part of the system config.
SizeOfDatum is the memory size of a Datum reference.
SizeOfDatums is the memory size of a Datum slice.
SkipFKs can be passed to row writer to skip fk validity checks.
Descriptor is being added.
Descriptor is being dropped.
Not used.
These system tables are not part of the system config.
These system tables are part of the system config.
web_sessions are used to track authenticated user actions over stateless connections, such as the cookie-based authentication used by the Admin UI.
Zone settings per DB/Table.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DefaultSearchPath is the search path used by virgin sessions.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DescriptorTable is the descriptor for the descriptor table.
ErrDescriptorNotFound is returned by GetTableDescFromID to signal that a descriptor could not be found with the given id.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ErrMissingColumns indicates a table with no columns.
ErrMissingPrimaryKey indicates a table with no primary key.
EventLogTable is the descriptor for the event log table.
No description provided by the author
No description provided by the author
JobsTable is the descriptor for the jobs table.
LeaseTable is the descriptor for the leases table.
NamespaceTable is the descriptor for the namespace table.
RangeEventTable is the descriptor for the range log table.
SettingsTable is the descriptor for the jobs table.
SystemAllowedPrivileges describes the allowable privilege lists for each system object.
SystemDB is the descriptor for the system database.
No description provided by the author
No description provided by the author
UITable is the descriptor for the ui table.
UsersTable is the descriptor for the users table.
WebSessions table to authenticate sessions over stateless connections.
ZonesTable is the descriptor for the zones table.

# Structs

CancelChecker is a helper object for repeatedly checking whether the associated context has been cancelled or not.
ColTypeInfo is a type that allows multiple representations of column type information (to avoid conversions and allocations).
No description provided by the author
ColumnFamilyDescriptor is set of columns stored together in one kv entry.
ColumnOrderInfo describes a column (as an index) and a desired order direction.
No description provided by the author
ConstraintDetail describes a constraint.
DatabaseDescriptor represents a namespace (aka database) and is stored in a structured metadata key.
DatumAlloc provides batch allocation of datum pointers, amortizing the cost of the allocations.
Descriptor is a union type holding either a table or database descriptor.
No description provided by the author
No description provided by the author
A DescriptorMutation represents a column or an index that has either been added or dropped and hasn't yet transitioned into a stable state: completely backfilled and visible, or completely deleted.
No description provided by the author
No description provided by the author
EncDatum represents a datum that is "backed" by an encoding and/or by a parser.Datum.
EncDatumRowAlloc is a helper that speeds up allocation of EncDatumRows (preferably of the same length).
No description provided by the author
IndexDescriptor describes an index (primary or secondary).
IndexEntry represents an encoded key/value for an index entry.
InterleaveDescriptor represents an index (either primary or secondary) that is interleaved into another table's data.
No description provided by the author
MetadataSchema is used to construct the initial sql schema for a new CockroachDB cluster being bootstrapped.
PrivilegeDescriptor describes a list of users and attached privileges.
ResultColumn contains the name and type of a SQL "cell".
RowContainer is a container for rows of Datums which tracks the approximate amount of memory allocated for row data.
RowDeleter abstracts the key/value operations for deleting table rows.
RowFetcher handles fetching kvs and forming table rows.
RowInserter abstracts the key/value operations for inserting table rows.
RowUpdater abstracts the key/value operations for updating table rows.
A TableDescriptor represents a table or view and is stored in a structured metadata key.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
The schema update lease.
TableLookup is the value type of TableLookupsByID: An optional table descriptor, populated when the table is public/leasable, and an IsAdding flag.
UserPrivileges describes the list of privileges available for a given user.
UserPrivilegeString is a pair of strings describing the privileges for a given user.

# Interfaces

DescriptorKey is the interface implemented by both databaseKey and tableKey.
DescriptorProto is the interface implemented by both DatabaseDescriptor and TableDescriptor.
FkSpanCollector can collect the spans that foreign key validation will touch.

# Type aliases

ColumnID is a custom type for ColumnDescriptor IDs.
ColumnOrdering is used to describe a desired column ordering.
These mirror the types supported by the sql/parser.
No description provided by the author
ConstraintType is used to identify the type of a constraint.
No description provided by the author
DatumEncoding identifies the encoding used for an EncDatum.
Direction of mutation.
A descriptor within a mutation is unavailable for reads, writes and deletes.
DescriptorVersion is a custom type for TableDescriptor Versions.
EncDatumRow is a row of EncDatums.
EncDatumRows is a slice of EncDatumRows.
FamilyID is a custom type for ColumnFamilyDescriptor IDs.
FKCheck indicates a kind of FK check (delete, insert, or both).
FormatVersion is a custom type for TableDescriptor versions of the sql to key:value mapping.go:generate stringer -type=FormatVersion.
ID is a custom type for {Database,Table}Descriptor IDs.
IDs is a sortable list of IDs.
The direction of a column in the index.
IndexID is a custom type for IndexDescriptor IDs.
MutationID is a custom type for TableDescriptor mutations.
ResultColumns is the type used throughout the sql module to describe the column types of a table.
State is set if this TableDescriptor is in the process of being added or deleted.
TableDescriptors is a sortable list of *TableDescriptors.
TableLookupsByID maps table IDs to looked up descriptors or, for tables that exist but are not yet public/leasable, entries with just the IsAdding flag.