{"modulePath":"github.com/aishraj/cockroach","version":"v0.0.0-20161006035549-d94915de34e6","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package sqlbase\n\nPackage sqlbase is a generated protocol buffer package.\n\nIt is generated from these files:\n\n\tcockroach/sql/sqlbase/backup.proto\n\tcockroach/sql/sqlbase/encoded_datum.proto\n\tcockroach/sql/sqlbase/privilege.proto\n\tcockroach/sql/sqlbase/structured.proto\n\nIt has these top-level messages:\n\n\tBackupRangeDescriptor\n\tBackupDescriptor\n\tUserPrivileges\n\tPrivilegeDescriptor\n\tColumnType\n\tForeignKeyReference\n\tColumnDescriptor\n\tColumnFamilyDescriptor\n\tInterleaveDescriptor\n\tIndexDescriptor\n\tDescriptorMutation\n\tTableDescriptor\n\tDatabaseDescriptor\n\tDescriptor\n\n## Constants\n\n```go\nconst (\n\t// NamespaceTableSchema is checked in TestSystemTables.\n\tNamespaceTableSchema = `\nCREATE TABLE system.namespace (\n  parentID INT,\n  name     STRING,\n  id       INT,\n  PRIMARY KEY (parentID, name)\n);`\n\n\t// DescriptorTableSchema is checked in TestSystemTables.\n\tDescriptorTableSchema = `\nCREATE TABLE system.descriptor (\n  id         INT PRIMARY KEY,\n  descriptor BYTES\n);`\n\n\t// UsersTableSchema is checked in TestSystemTables.\n\tUsersTableSchema = `\nCREATE TABLE system.users (\n  username       STRING PRIMARY KEY,\n  hashedPassword BYTES\n);`\n\n\t// ZonesTableSchema is checked in TestSystemTables.\n\t// Zone settings per DB/Table.\n\tZonesTableSchema = `\nCREATE TABLE system.zones (\n  id     INT PRIMARY KEY,\n  config BYTES\n);`\n)\n```\nsql CREATE commands and full schema for each system table. These strings are \\*not\\* used at runtime, but are checked by the \\`TestSystemTableLiterals\\` test that compares the table generated by evaluating the \\`CREATE TABLE\\` statement to the descriptor literal that is actually used at runtime.\n\n```go\nconst (\n\t// LeaseTableSchema is checked in TestSystemTables.\n\tLeaseTableSchema = `\nCREATE TABLE system.lease (\n  descID     INT,\n  version    INT,\n  nodeID     INT,\n  expiration TIMESTAMP,\n  PRIMARY KEY (descID, version, expiration, nodeID)\n);`\n\n\t// EventLogTableSchema describes the schema of the event log table.\n\tEventLogTableSchema = `\nCREATE TABLE system.eventlog (\n  timestamp    TIMESTAMP  NOT NULL,\n  eventType    STRING     NOT NULL,\n  targetID     INT        NOT NULL,\n  reportingID  INT        NOT NULL,\n  info         STRING,\n  uniqueID     BYTES      DEFAULT experimental_unique_bytes(),\n  PRIMARY KEY (timestamp, uniqueID)\n);`\n\n\t// RangeEventTableSchema defines the schema of the event log table. It is\n\t// currently envisioned as a wide table; many different event types can be\n\t// recorded to the table.\n\tRangeEventTableSchema = `\nCREATE TABLE system.rangelog (\n  timestamp     TIMESTAMP  NOT NULL,\n  rangeID       INT        NOT NULL,\n  storeID       INT        NOT NULL,\n  eventType     STRING     NOT NULL,\n  otherRangeID  INT,\n  info          STRING,\n  uniqueID      INT        DEFAULT unique_rowid(),\n  PRIMARY KEY (timestamp, uniqueID)\n);`\n\n\t// UITableSchema is checked in TestSystemTables.\n\t// blobs based on unique keys.\n\tUITableSchema = `\nCREATE TABLE system.ui (\n\tkey         STRING PRIMARY KEY,\n\tvalue       BYTES,\n\tlastUpdated TIMESTAMP NOT NULL\n);`\n)\n```\nThese system tables are not part of the system config.\n\n```go\nconst FamilyHeuristicTargetBytes = 256\n```\nFamilyHeuristicTargetBytes is the target total byte size of columns that the current heuristic will assign to a family.\n\n```go\nconst (\n\t// PrimaryKeyIndexName is the name of the index for the primary key.\n\tPrimaryKeyIndexName = \"primary\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\tErrInvalidLengthBackup = fmt.Errorf(\"proto: negative length found during unmarshaling\")\n\tErrIntOverflowBackup   = fmt.Errorf(\"proto: integer overflow\")\n)\n```\n\n```go\nvar (\n\tErrInvalidLengthPrivilege = fmt.Errorf(\"proto: negative length found during unmarshaling\")\n\tErrIntOverflowPrivilege   = fmt.Errorf(\"proto: integer overflow\")\n)\n```\n\n```go\nvar (\n\tErrInvalidLengthStructured = fmt.Errorf(\"proto: negative length found during unmarshaling\")\n\tErrIntOverflowStructured   = fmt.Errorf(\"proto: integer overflow\")\n)\n```\n\n```go\nvar (\n\t// SystemDB is the descriptor for the system database.\n\tSystemDB = DatabaseDescriptor{\n\t\tName: \"system\",\n\t\tID:   keys.SystemDatabaseID,\n\n\t\tPrivileges: NewPrivilegeDescriptor(security.RootUser,\n\t\t\tSystemConfigAllowedPrivileges[keys.SystemDatabaseID]),\n\t}\n\n\t// NamespaceTable is the descriptor for the namespace table.\n\tNamespaceTable = TableDescriptor{\n\t\tName:     \"namespace\",\n\t\tID:       keys.NamespaceTableID,\n\t\tParentID: 1,\n\t\tVersion:  1,\n\t\tColumns: []ColumnDescriptor{\n\t\t\t{Name: \"parentID\", ID: 1, Type: colTypeInt},\n\t\t\t{Name: \"name\", ID: 2, Type: colTypeString},\n\t\t\t{Name: \"id\", ID: 3, Type: colTypeInt, Nullable: true},\n\t\t},\n\t\tNextColumnID: 4,\n\t\tFamilies: []ColumnFamilyDescriptor{\n\t\t\t{Name: \"primary\", ID: 0, ColumnNames: []string{\"parentID\", \"name\"}, ColumnIDs: []ColumnID{1, 2}},\n\t\t\t{Name: \"fam_3_id\", ID: 3, ColumnNames: []string{\"id\"}, ColumnIDs: []ColumnID{3}, DefaultColumnID: 3},\n\t\t},\n\t\tNextFamilyID: 4,\n\t\tPrimaryIndex: IndexDescriptor{\n\t\t\tName:             \"primary\",\n\t\t\tID:               1,\n\t\t\tUnique:           true,\n\t\t\tColumnNames:      []string{\"parentID\", \"name\"},\n\t\t\tColumnDirections: []IndexDescriptor_Direction{IndexDescriptor_ASC, IndexDescriptor_ASC},\n\t\t\tColumnIDs:        []ColumnID{1, 2},\n\t\t},\n\t\tNextIndexID:    2,\n\t\tPrivileges:     NewPrivilegeDescriptor(security.RootUser, SystemConfigAllowedPrivileges[2]),\n\t\tFormatVersion:  InterleavedFormatVersion,\n\t\tNextMutationID: 1,\n\t}\n\n\t// DescriptorTable is the descriptor for the descriptor table.\n\tDescriptorTable = TableDescriptor{\n\t\tName:       \"descriptor\",\n\t\tID:         keys.DescriptorTableID,\n\t\tPrivileges: NewPrivilegeDescriptor(security.RootUser, SystemConfigAllowedPrivileges[3]),\n\t\tParentID:   1,\n\t\tVersion:    1,\n\t\tColumns: []ColumnDescriptor{\n\t\t\t{Name: \"id\", ID: 1, Type: colTypeInt},\n\t\t\t{Name: \"descriptor\", ID: 2, Type: colTypeBytes, Nullable: true},\n\t\t},\n\t\tNextColumnID: 3,\n\t\tFamilies: []ColumnFamilyDescriptor{\n\t\t\t{Name: \"primary\", ID: 0, ColumnNames: []string{\"id\"}, ColumnIDs: singleID1},\n\t\t\t{Name: \"fam_2_descriptor\", ID: 2, ColumnNames: []string{\"descriptor\"}, ColumnIDs: []ColumnID{2}, DefaultColumnID: 2},\n\t\t},\n\t\tPrimaryIndex:   pk(\"id\"),\n\t\tNextFamilyID:   3,\n\t\tNextIndexID:    2,\n\t\tFormatVersion:  InterleavedFormatVersion,\n\t\tNextMutationID: 1,\n\t}\n\n\t// UsersTable is the descriptor for the users table.\n\tUsersTable = TableDescriptor{\n\t\tName:     \"users\",\n\t\tID:       keys.UsersTableID,\n\t\tParentID: 1,\n\t\tVersion:  1,\n\t\tColumns: []ColumnDescriptor{\n\t\t\t{Name: \"username\", ID: 1, Type: colTypeString},\n\t\t\t{Name: \"hashedPassword\", ID: 2, Type: colTypeBytes, Nullable: true},\n\t\t},\n\t\tNextColumnID: 3,\n\t\tFamilies: []ColumnFamilyDescriptor{\n\t\t\t{Name: \"primary\", ID: 0, ColumnNames: []string{\"username\"}, ColumnIDs: singleID1},\n\t\t\t{Name: \"fam_2_hashedPassword\", ID: 2, ColumnNames: []string{\"hashedPassword\"}, ColumnIDs: []ColumnID{2}, DefaultColumnID: 2},\n\t\t},\n\t\tPrimaryIndex:   pk(\"username\"),\n\t\tNextFamilyID:   3,\n\t\tNextIndexID:    2,\n\t\tPrivileges:     NewPrivilegeDescriptor(security.RootUser, SystemConfigAllowedPrivileges[4]),\n\t\tFormatVersion:  InterleavedFormatVersion,\n\t\tNextMutationID: 1,\n\t}\n\n\t// ZonesTable is the descriptor for the zones table.\n\tZonesTable = TableDescriptor{\n\t\tName:     \"zones\",\n\t\tID:       keys.ZonesTableID,\n\t\tParentID: 1,\n\t\tVersion:  1,\n\t\tColumns: []ColumnDescriptor{\n\t\t\t{Name: \"id\", ID: 1, Type: colTypeInt},\n\t\t\t{Name: \"config\", ID: 2, Type: colTypeBytes, Nullable: true},\n\t\t},\n\t\tNextColumnID: 3,\n\t\tFamilies: []ColumnFamilyDescriptor{\n\t\t\t{Name: \"primary\", ID: 0, ColumnNames: []string{\"id\"}, ColumnIDs: singleID1},\n\t\t\t{Name: \"fam_2_config\", ID: 2, ColumnNames: []string{\"config\"}, ColumnIDs: []ColumnID{2}, DefaultColumnID: 2},\n\t\t},\n\t\tPrimaryIndex:   pk(\"id\"),\n\t\tNextFamilyID:   3,\n\t\tNextIndexID:    2,\n\t\tPrivileges:     NewPrivilegeDescriptor(security.RootUser, SystemConfigAllowedPrivileges[5]),\n\t\tFormatVersion:  InterleavedFormatVersion,\n\t\tNextMutationID: 1,\n\t}\n\n\t// SystemConfigAllowedPrivileges describes the privileges allowed for each\n\t// system config object. No user may have more than those privileges, and\n\t// the root user must have exactly those privileges. CREATE|DROP|ALL\n\t// should always be denied.\n\tSystemConfigAllowedPrivileges = map[ID]privilege.List{\n\t\tkeys.SystemDatabaseID:  privilege.ReadData,\n\t\tkeys.NamespaceTableID:  privilege.ReadData,\n\t\tkeys.DescriptorTableID: privilege.ReadData,\n\t\tkeys.UsersTableID:      privilege.ReadWriteData,\n\t\tkeys.ZonesTableID:      privilege.ReadWriteData,\n\t}\n)\n```\nThese system config TableDescriptor literals should match the descriptor that would be produced by evaluating one of the above \\`CREATE TABLE\\` statements. See the \\`TestSystemTableLiterals\\` which checks that they do indeed match, and has suggestions on writing and maintaining them.\n\n```go\nvar (\n\t// LeaseTable is the descriptor for the leases table.\n\tLeaseTable = TableDescriptor{\n\t\tName:     \"lease\",\n\t\tID:       keys.LeaseTableID,\n\t\tParentID: 1,\n\t\tVersion:  1,\n\t\tColumns: []ColumnDescriptor{\n\t\t\t{Name: \"descID\", ID: 1, Type: colTypeInt},\n\t\t\t{Name: \"version\", ID: 2, Type: colTypeInt},\n\t\t\t{Name: \"nodeID\", ID: 3, Type: colTypeInt},\n\t\t\t{Name: \"expiration\", ID: 4, Type: colTypeTimestamp},\n\t\t},\n\t\tNextColumnID: 5,\n\t\tFamilies: []ColumnFamilyDescriptor{\n\t\t\t{Name: \"primary\", ID: 0, ColumnNames: []string{\"descID\", \"version\", \"nodeID\", \"expiration\"}, ColumnIDs: []ColumnID{1, 2, 3, 4}},\n\t\t},\n\t\tPrimaryIndex: IndexDescriptor{\n\t\t\tName:             \"primary\",\n\t\t\tID:               1,\n\t\t\tUnique:           true,\n\t\t\tColumnNames:      []string{\"descID\", \"version\", \"expiration\", \"nodeID\"},\n\t\t\tColumnDirections: []IndexDescriptor_Direction{IndexDescriptor_ASC, IndexDescriptor_ASC, IndexDescriptor_ASC, IndexDescriptor_ASC},\n\t\t\tColumnIDs:        []ColumnID{1, 2, 4, 3},\n\t\t},\n\t\tNextFamilyID:   1,\n\t\tNextIndexID:    2,\n\t\tPrivileges:     NewDefaultPrivilegeDescriptor(),\n\t\tFormatVersion:  InterleavedFormatVersion,\n\t\tNextMutationID: 1,\n\t}\n\n\t// EventLogTable is the descriptor for the event log table.\n\tEventLogTable = TableDescriptor{\n\t\tName:     \"eventlog\",\n\t\tID:       keys.EventLogTableID,\n\t\tParentID: 1,\n\t\tVersion:  1,\n\t\tColumns: []ColumnDescriptor{\n\t\t\t{Name: \"timestamp\", ID: 1, Type: colTypeTimestamp},\n\t\t\t{Name: \"eventType\", ID: 2, Type: colTypeString},\n\t\t\t{Name: \"targetID\", ID: 3, Type: colTypeInt},\n\t\t\t{Name: \"reportingID\", ID: 4, Type: colTypeInt},\n\t\t\t{Name: \"info\", ID: 5, Type: colTypeString, Nullable: true},\n\t\t\t{Name: \"uniqueID\", ID: 6, Type: colTypeBytes, DefaultExpr: \u0026experimentalUniqueBytesString},\n\t\t},\n\t\tNextColumnID: 7,\n\t\tFamilies: []ColumnFamilyDescriptor{\n\t\t\t{Name: \"primary\", ID: 0, ColumnNames: []string{\"timestamp\", \"uniqueID\"}, ColumnIDs: []ColumnID{1, 6}},\n\t\t\t{Name: \"fam_2_eventType\", ID: 2, ColumnNames: []string{\"eventType\"}, ColumnIDs: []ColumnID{2}, DefaultColumnID: 2},\n\t\t\t{Name: \"fam_3_targetID\", ID: 3, ColumnNames: []string{\"targetID\"}, ColumnIDs: []ColumnID{3}, DefaultColumnID: 3},\n\t\t\t{Name: \"fam_4_reportingID\", ID: 4, ColumnNames: []string{\"reportingID\"}, ColumnIDs: []ColumnID{4}, DefaultColumnID: 4},\n\t\t\t{Name: \"fam_5_info\", ID: 5, ColumnNames: []string{\"info\"}, ColumnIDs: []ColumnID{5}, DefaultColumnID: 5},\n\t\t},\n\t\tPrimaryIndex: IndexDescriptor{\n\t\t\tName:             \"primary\",\n\t\t\tID:               1,\n\t\t\tUnique:           true,\n\t\t\tColumnNames:      []string{\"timestamp\", \"uniqueID\"},\n\t\t\tColumnDirections: []IndexDescriptor_Direction{IndexDescriptor_ASC, IndexDescriptor_ASC},\n\t\t\tColumnIDs:        []ColumnID{1, 6},\n\t\t},\n\t\tNextFamilyID:   6,\n\t\tNextIndexID:    2,\n\t\tPrivileges:     NewDefaultPrivilegeDescriptor(),\n\t\tFormatVersion:  InterleavedFormatVersion,\n\t\tNextMutationID: 1,\n\t}\n\n\t// RangeEventTable is the descriptor for the range log table.\n\tRangeEventTable = TableDescriptor{\n\t\tName:     \"rangelog\",\n\t\tID:       keys.RangeEventTableID,\n\t\tParentID: 1,\n\t\tVersion:  1,\n\t\tColumns: []ColumnDescriptor{\n\t\t\t{Name: \"timestamp\", ID: 1, Type: colTypeTimestamp},\n\t\t\t{Name: \"rangeID\", ID: 2, Type: colTypeInt},\n\t\t\t{Name: \"storeID\", ID: 3, Type: colTypeInt},\n\t\t\t{Name: \"eventType\", ID: 4, Type: colTypeString},\n\t\t\t{Name: \"otherRangeID\", ID: 5, Type: colTypeInt, Nullable: true},\n\t\t\t{Name: \"info\", ID: 6, Type: colTypeString, Nullable: true},\n\t\t\t{Name: \"uniqueID\", ID: 7, Type: colTypeInt, DefaultExpr: \u0026uniqueRowIDString},\n\t\t},\n\t\tNextColumnID: 8,\n\t\tFamilies: []ColumnFamilyDescriptor{\n\t\t\t{Name: \"primary\", ID: 0, ColumnNames: []string{\"timestamp\", \"uniqueID\"}, ColumnIDs: []ColumnID{1, 7}},\n\t\t\t{Name: \"fam_2_rangeID\", ID: 2, ColumnNames: []string{\"rangeID\"}, ColumnIDs: []ColumnID{2}, DefaultColumnID: 2},\n\t\t\t{Name: \"fam_3_storeID\", ID: 3, ColumnNames: []string{\"storeID\"}, ColumnIDs: []ColumnID{3}, DefaultColumnID: 3},\n\t\t\t{Name: \"fam_4_eventType\", ID: 4, ColumnNames: []string{\"eventType\"}, ColumnIDs: []ColumnID{4}, DefaultColumnID: 4},\n\t\t\t{Name: \"fam_5_otherRangeID\", ID: 5, ColumnNames: []string{\"otherRangeID\"}, ColumnIDs: []ColumnID{5}, DefaultColumnID: 5},\n\t\t\t{Name: \"fam_6_info\", ID: 6, ColumnNames: []string{\"info\"}, ColumnIDs: []ColumnID{6}, DefaultColumnID: 6},\n\t\t},\n\t\tPrimaryIndex: IndexDescriptor{\n\t\t\tName:             \"primary\",\n\t\t\tID:               1,\n\t\t\tUnique:           true,\n\t\t\tColumnNames:      []string{\"timestamp\", \"uniqueID\"},\n\t\t\tColumnDirections: []IndexDescriptor_Direction{IndexDescriptor_ASC, IndexDescriptor_ASC},\n\t\t\tColumnIDs:        []ColumnID{1, 7},\n\t\t},\n\t\tNextFamilyID:   7,\n\t\tNextIndexID:    2,\n\t\tPrivileges:     NewDefaultPrivilegeDescriptor(),\n\t\tFormatVersion:  InterleavedFormatVersion,\n\t\tNextMutationID: 1,\n\t}\n\n\t// UITable is the descriptor for the ui table.\n\tUITable = TableDescriptor{\n\t\tName:     \"ui\",\n\t\tID:       keys.UITableID,\n\t\tParentID: 1,\n\t\tVersion:  1,\n\t\tColumns: []ColumnDescriptor{\n\t\t\t{Name: \"key\", ID: 1, Type: colTypeString},\n\t\t\t{Name: \"value\", ID: 2, Type: colTypeBytes, Nullable: true},\n\t\t\t{Name: \"lastUpdated\", ID: 3, Type: ColumnType{Kind: ColumnType_TIMESTAMP}},\n\t\t},\n\t\tNextColumnID: 4,\n\t\tFamilies: []ColumnFamilyDescriptor{\n\t\t\t{Name: \"primary\", ID: 0, ColumnNames: []string{\"key\"}, ColumnIDs: singleID1},\n\t\t\t{Name: \"fam_2_value\", ID: 2, ColumnNames: []string{\"value\"}, ColumnIDs: []ColumnID{2}, DefaultColumnID: 2},\n\t\t\t{Name: \"fam_3_lastUpdated\", ID: 3, ColumnNames: []string{\"lastUpdated\"}, ColumnIDs: []ColumnID{3}, DefaultColumnID: 3},\n\t\t},\n\t\tNextFamilyID:   4,\n\t\tPrimaryIndex:   pk(\"key\"),\n\t\tNextIndexID:    2,\n\t\tPrivileges:     NewDefaultPrivilegeDescriptor(),\n\t\tFormatVersion:  InterleavedFormatVersion,\n\t\tNextMutationID: 1,\n\t}\n)\n```\nThese system TableDescriptor literals should match the descriptor that would be produced by evaluating one of the above \\`CREATE TABLE\\` statements for system tables that are not system config tables. See the \\`TestSystemTableLiterals\\` which checks that they do indeed match, and has suggestions on writing and maintaining them.\n\n```go\nvar ColumnType_Kind_name = map[int32]string{\n\t0: \"BOOL\",\n\t1: \"INT\",\n\t2: \"FLOAT\",\n\t3: \"DECIMAL\",\n\t4: \"DATE\",\n\t5: \"TIMESTAMP\",\n\t6: \"INTERVAL\",\n\t7: \"STRING\",\n\t8: \"BYTES\",\n\t9: \"TIMESTAMPTZ\",\n}\n```\n\n```go\nvar ColumnType_Kind_value = map[string]int32{\n\t\"BOOL\":        0,\n\t\"INT\":         1,\n\t\"FLOAT\":       2,\n\t\"DECIMAL\":     3,\n\t\"DATE\":        4,\n\t\"TIMESTAMP\":   5,\n\t\"INTERVAL\":    6,\n\t\"STRING\":      7,\n\t\"BYTES\":       8,\n\t\"TIMESTAMPTZ\": 9,\n}\n```\n\n```go\nvar ConstraintValidity_name = map[int32]string{\n\t0: \"Validated\",\n\t1: \"Unvalidated\",\n}\n```\n\n```go\nvar ConstraintValidity_value = map[string]int32{\n\t\"Validated\":   0,\n\t\"Unvalidated\": 1,\n}\n```\n\n```go\nvar DatumEncoding_name = map[int32]string{\n\t0: \"ASCENDING_KEY\",\n\t1: \"DESCENDING_KEY\",\n\t2: \"VALUE\",\n}\n```\n\n```go\nvar DatumEncoding_value = map[string]int32{\n\t\"ASCENDING_KEY\":  0,\n\t\"DESCENDING_KEY\": 1,\n\t\"VALUE\":          2,\n}\n```\n\n```go\nvar DescriptorMutation_Direction_name = map[int32]string{\n\t0: \"NONE\",\n\t1: \"ADD\",\n\t2: \"DROP\",\n}\n```\n\n```go\nvar DescriptorMutation_Direction_value = map[string]int32{\n\t\"NONE\": 0,\n\t\"ADD\":  1,\n\t\"DROP\": 2,\n}\n```\n\n```go\nvar DescriptorMutation_State_name = map[int32]string{\n\t0: \"UNKNOWN\",\n\t1: \"DELETE_ONLY\",\n\t2: \"WRITE_ONLY\",\n}\n```\n\n```go\nvar DescriptorMutation_State_value = map[string]int32{\n\t\"UNKNOWN\":     0,\n\t\"DELETE_ONLY\": 1,\n\t\"WRITE_ONLY\":  2,\n}\n```\n\n```go\nvar ErrDescriptorNotFound = errors.New(\"descriptor not found\")\n```\nErrDescriptorNotFound is returned by GetTableDescFromID to signal that a descriptor could not be found with the given id.\n\n```go\nvar ErrMissingColumns = errors.New(\"table must contain at least 1 column\")\n```\nErrMissingColumns indicates a table with no columns.\n\n```go\nvar ErrMissingPrimaryKey = errors.New(\"table must contain a primary key\")\n```\nErrMissingPrimaryKey indicates a table with no primary key.\n\n```go\nvar IndexDescriptor_Direction_name = map[int32]string{\n\t0: \"ASC\",\n\t1: \"DESC\",\n}\n```\n\n```go\nvar IndexDescriptor_Direction_value = map[string]int32{\n\t\"ASC\":  0,\n\t\"DESC\": 1,\n}\n```\n\n```go\nvar TableDescriptor_State_name = map[int32]string{\n\t0: \"PUBLIC\",\n\t1: \"ADD\",\n\t2: \"DROP\",\n}\n```\n\n```go\nvar TableDescriptor_State_value = map[string]int32{\n\t\"PUBLIC\": 0,\n\t\"ADD\":    1,\n\t\"DROP\":   2,\n}\n```\n\n## Functions\n\n```go\nfunc CheckColumnType(col ColumnDescriptor, val parser.Datum, pmap *parser.PlaceholderInfo) error\n```\nCheckColumnType verifies that a given value is compatible with the type requested by the column. If the value is a placeholder, the type of the placeholder gets populated.\n\n```go\nfunc CheckValueWidth(col ColumnDescriptor, val parser.Datum) error\n```\nCheckValueWidth checks that the width (for strings, byte arrays, and bit string) and scale (for decimals) of the value fits the specified column type. Used by INSERT and UPDATE.\n\n```go\nfunc ColumnsSelectors(cols []ColumnDescriptor) parser.SelectExprs\n```\nColumnsSelectors generates Select expressions for cols.\n\n```go\nfunc DecodeIndexKey(\n\ta *DatumAlloc,\n\tdesc *TableDescriptor,\n\tindexID IndexID,\n\tvalTypes, vals []parser.Datum,\n\tcolDirs []encoding.Direction,\n\tkey []byte,\n) ([]byte, bool, error)\n```\nDecodeIndexKey decodes the values that are a part of the specified index key. ValTypes is a slice returned from makeKeyVals. The remaining bytes in the index key are returned which will either be an encoded column ID for the primary key index, the primary key suffix for non-unique secondary indexes or unique secondary indexes containing NULL or empty. If the given descriptor does not match the key, false is returned with no error.\n\n```go\nfunc DecodeKeyVals(\n\ta *DatumAlloc, valTypes, vals []parser.Datum, directions []encoding.Direction, key []byte,\n) ([]byte, error)\n```\nDecodeKeyVals decodes the values that are part of the key. ValTypes is a slice returned from makeKeyVals. The decoded values are stored in the vals parameter while the valTypes parameter is unmodified. Note that len(vals) \u003e= len(valTypes). The types of the decoded values will match the corresponding entry in the valTypes parameter with the exception that a value might also be parser.DNull. The remaining bytes in the key after decoding the values are returned. A slice of directions can be provided to enforce encoding direction on each value in valTypes. If this slice is nil, the direction used will default to encoding.Ascending.\n\n```go\nfunc DecodeTableIDIndexID(key []byte) ([]byte, ID, IndexID, error)\n```\nDecodeTableIDIndexID decodes a table id followed by an index id.\n\n```go\nfunc DecodeTableKey(\n\ta *DatumAlloc, valType parser.Datum, key []byte, dir encoding.Direction,\n) (parser.Datum, []byte, error)\n```\nDecodeTableKey decodes a table key/value.\n\n```go\nfunc DecodeTableValue(a *DatumAlloc, valType parser.Datum, b []byte) (parser.Datum, []byte, error)\n```\nDecodeTableValue decodes a value encoded by EncodeTableValue.\n\n```go\nfunc EncodeColumns(\n\tcolumnIDs []ColumnID,\n\tdirections directions,\n\tcolMap map[ColumnID]int,\n\tvalues []parser.Datum,\n\tkeyPrefix []byte,\n) (key []byte, containsNull bool, err error)\n```\nEncodeColumns is a version of EncodeIndexKey that takes ColumnIDs and directions explicitly.\n\n```go\nfunc EncodeDTuple(b []byte, d parser.DTuple) ([]byte, error)\n```\nEncodeDTuple encodes a DTuple (order-preserving).\n\n```go\nfunc EncodeDatum(b []byte, d parser.Datum) ([]byte, error)\n```\nEncodeDatum encodes a datum (order-preserving encoding, suitable for keys).\n\n```go\nfunc EncodeIndexKey(\n\ttableDesc *TableDescriptor,\n\tindex *IndexDescriptor,\n\tcolMap map[ColumnID]int,\n\tvalues []parser.Datum,\n\tkeyPrefix []byte,\n) (key []byte, containsNull bool, err error)\n```\nEncodeIndexKey creates a key by concatenating keyPrefix with the encodings of the columns in the index.\n\nIf a table or index is interleaved, \\`encoding.encodedNullDesc\\` is used in place of the family id (a varint) to signal the next component of the key. An example of one level of interleaving (a parent): /\\\u003cparent\\_table\\_id\u003e/\\\u003cparent\\_index\\_id\u003e/\\\u003cfield\\_1\u003e/\\\u003cfield\\_2\u003e/NullDesc/\\\u003ctable\\_id\u003e/\\\u003cindex\\_id\u003e/\\\u003cfield\\_3\u003e/\\\u003cfamily\u003e\n\nReturns the key and whether any of the encoded values were NULLs.\n\nNote that ImplicitColumnIDs are not encoded, so the result isn't always a full index key.\n\n```go\nfunc EncodeSecondaryIndexes(\n\ttableDesc *TableDescriptor,\n\tindexes []IndexDescriptor,\n\tcolMap map[ColumnID]int,\n\tvalues []parser.Datum,\n\tsecondaryIndexEntries []IndexEntry,\n) error\n```\nEncodeSecondaryIndexes encodes key/values for the secondary indexes. colMap maps ColumnIDs to indices in \\`values\\`. secondaryIndexEntries is the return value (passed as a parameter so the caller can reuse between rows) and is expected to be the same length as indexes.\n\n```go\nfunc EncodeTableKey(b []byte, val parser.Datum, dir encoding.Direction) ([]byte, error)\n```\nEncodeTableKey encodes \\`val\\` into \\`b\\` and returns the new buffer.\n\n```go\nfunc EncodeTableValue(appendTo []byte, colID ColumnID, val parser.Datum) ([]byte, error)\n```\nEncodeTableValue encodes \\`val\\` into \\`appendTo\\` using DatumEncoding\\_VALUE and returns the new buffer.\n\n```go\nfunc EqualName(a, b parser.Name) bool\n```\nEqualName returns true iff the normalizations of a and b are equal.\n\n```go\nfunc ExtractIndexKey(\n\ta *DatumAlloc, tableDesc *TableDescriptor, entry client.KeyValue,\n) (roachpb.Key, error)\n```\nExtractIndexKey constructs the index (primary) key for a row from any index key/value entry, including secondary indexes.\n\nDon't use this function in the scan \"hot path\".\n\n```go\nfunc IsIntegrityConstraintError(err error) bool\n```\nIsIntegrityConstraintError returns true if the error is some kind of SQL constraint violation.\n\n```go\nfunc IsSystemConfigID(id ID) bool\n```\nIsSystemConfigID returns true if this ID is for a system config object.\n\n```go\nfunc MakeAllDescsMetadataKey() roachpb.Key\n```\nMakeAllDescsMetadataKey returns the key for all descriptors.\n\n```go\nfunc MakeColumnDefDescs(d *parser.ColumnTableDef) (*ColumnDescriptor, *IndexDescriptor, error)\n```\nMakeColumnDefDescs creates the column descriptor for a column, as well as the index descriptor if the column is a primary key or unique.\n\n```go\nfunc MakeDescMetadataKey(descID ID) roachpb.Key\n```\nMakeDescMetadataKey returns the key for the descriptor.\n\n```go\nfunc MakeIndexKeyPrefix(desc *TableDescriptor, indexID IndexID) []byte\n```\nMakeIndexKeyPrefix returns the key prefix used for the index's data.\n\n```go\nfunc MakeKeyFromEncDatums(\n\tvalues EncDatumRow, directions []IndexDescriptor_Direction, keyPrefix []byte, alloc *DatumAlloc,\n) (key roachpb.Key, err error)\n```\nMakeKeyFromEncDatums creates a key by concatenating keyPrefix with the encodings of the given EncDatum values.\n\n```go\nfunc MakeKeyVals(desc *TableDescriptor, columnIDs []ColumnID) ([]parser.Datum, error)\n```\nMakeKeyVals returns a slice of Datums with the correct types for the given columns.\n\n```go\nfunc MakeNameMetadataKey(parentID ID, name string) roachpb.Key\n```\nMakeNameMetadataKey returns the key for the name. Pass name == \"\" in order to generate the prefix key to use to scan over all of the names for the specified parentID.\n\n```go\nfunc MakeZoneKey(id ID) roachpb.Key\n```\nMakeZoneKey returns the key for 'id's entry in the system.zones table.\n\n```go\nfunc MarshalColumnValue(col ColumnDescriptor, val parser.Datum) (roachpb.Value, error)\n```\nMarshalColumnValue returns a Go primitive value equivalent of val, of the type expected by col. If val's type is incompatible with col, or if col's type is not yet implemented, an error is returned.\n\n```go\nfunc NewDatabaseAlreadyExistsError(name string) error\n```\nNewDatabaseAlreadyExistsError creates a new ErrDatabaseAlreadyExists.\n\n```go\nfunc NewNonNullViolationError(columnName string) error\n```\nNewNonNullViolationError creates a new ErrNonNullViolation.\n\n```go\nfunc NewRelationAlreadyExistsError(name string) error\n```\nNewRelationAlreadyExistsError creates a new ErrRelationAlreadyExists.\n\n```go\nfunc NewRetryError(cause error) error\n```\nNewRetryError creates a ErrRetry.\n\n```go\nfunc NewSyntaxError(msg string) error\n```\nNewSyntaxError creates a new ErrSyntax.\n\n```go\nfunc NewTransactionAbortedError(customMsg string) error\n```\nNewTransactionAbortedError creates a new ErrTransactionAborted.\n\n```go\nfunc NewTransactionCommittedError() error\n```\nNewTransactionCommittedError creates a new ErrTransactionCommitted.\n\n```go\nfunc NewUndefinedDatabaseError(name string) error\n```\nNewUndefinedDatabaseError creates a new ErrUndefinedDatabase.\n\n```go\nfunc NewUndefinedTableError(name string) error\n```\nNewUndefinedTableError creates a new ErrUndefinedTable.\n\n```go\nfunc NewUndefinedViewError(name string) error\n```\nNewUndefinedViewError creates a new ErrUndefinedTable, which is also used for views (sharing the same postgres error code).\n\n```go\nfunc NewUniquenessConstraintViolationError(index *IndexDescriptor, vals []parser.Datum) error\n```\nNewUniquenessConstraintViolationError creates a new ErrUniquenessConstrainViolation.\n\n```go\nfunc NewWrongObjectTypeError(name, desiredObjType string) error\n```\nNewWrongObjectTypeError creates a new ErrWrongObjectType.\n\n```go\nfunc NormalizeName(name parser.Name) string\n```\nNormalizeName normalizes to lowercase and Unicode Normalization Form C (NFC).\n\n```go\nfunc NormalizeTableName(tn parser.TableName) parser.TableName\n```\nNormalizeTableName normalizes the TableName using NormalizeName().\n\n```go\nfunc PrettySpan(span roachpb.Span, skip int) string\n```\nPrettySpan returns a human-readable representation of a span.\n\n```go\nfunc PrettySpans(spans []roachpb.Span, skip int) string\n```\nPrettySpans returns a human-readable description of the spans.\n\n```go\nfunc RandDatum(rng *rand.Rand, typ ColumnType_Kind, null bool) parser.Datum\n```\nRandDatum generates a random Datum of the given type. If null is true, the datum can be DNull.\n\n```go\nfunc RandEncDatumSlices(rng *rand.Rand, numSets, numValsPerSet int) [][]EncDatum\n```\nRandEncDatumSlices generates EncDatum slices, each slice with values of the same random type.\n\n```go\nfunc ReNormalizeName(name string) string\n```\nReNormalizeName performs the same work as NormalizeName but when the string originates from the database. We define a different function so as to be able to track usage of this function (cf. #8200).\n\n```go\nfunc RunFilter(filter parser.TypedExpr, evalCtx *parser.EvalContext) (bool, error)\n```\nRunFilter runs a filter expression and returns whether the filter passes.\n\n```go\nfunc SanitizeVarFreeExpr(expr parser.Expr, expectedType parser.Datum, context string) error\n```\nSanitizeVarFreeExpr verifies a default expression is valid, has the correct type and contains no variable expressions.\n\n```go\nfunc SetKVBatchSize(val int64) func()\n```\nSetKVBatchSize changes the kvFetcher batch size, and returns a function that restores it.\n\n```go\nfunc UnmarshalColumnValue(\n\ta *DatumAlloc, kind ColumnType_Kind, value *roachpb.Value,\n) (parser.Datum, error)\n```\nUnmarshalColumnValue decodes the value from a key-value pair using the type expected by the column. An error is returned if the value's type does not match the column's type.\n\n## Types\n\n```go\ntype BackupDescriptor struct {\n\tEndTime cockroach_util_hlc.Timestamp `protobuf:\"bytes,1,opt,name=end_time,json=endTime\" json:\"end_time\"`\n\tRanges  []BackupRangeDescriptor      `protobuf:\"bytes,2,rep,name=ranges\" json:\"ranges\"`\n\tSQL     []Descriptor                 `protobuf:\"bytes,3,rep,name=sql\" json:\"sql\"`\n\t// TODO(dan): Consider also including total file size and per-range data and\n\t// file size.\n\tDataSize int64 `protobuf:\"varint,4,opt,name=data_size,json=dataSize,proto3\" json:\"data_size,omitempty\"`\n}\n```\nBackupDescriptor represents a consistent snapshot of ranges.\n\nEach range snapshot includes a path to data that is a diff of the data in that key range between a start and end timestamp. The end timestamp of all ranges in a backup is the same, but the start may vary (to allow individual tables to be backed up on different schedules).\n\n```go\nfunc (*BackupDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *BackupDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *BackupDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*BackupDescriptor) ProtoMessage()\n```\n\n```go\nfunc (m *BackupDescriptor) Reset()\n```\n\n```go\nfunc (m *BackupDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *BackupDescriptor) String() string\n```\n\n```go\nfunc (m *BackupDescriptor) Unmarshal(data []byte) error\n```\n\n```go\ntype BackupRangeDescriptor struct {\n\t// An empty path means the range is empty.\n\tPath      string                                       `protobuf:\"bytes,1,opt,name=path,proto3\" json:\"path,omitempty\"`\n\tStartKey  github_com_cockroachdb_cockroach_roachpb.Key `protobuf:\"bytes,2,opt,name=start_key,json=startKey,proto3,casttype=github.com/cockroachdb/cockroach/roachpb.Key\" json:\"start_key,omitempty\"`\n\tEndKey    github_com_cockroachdb_cockroach_roachpb.Key `protobuf:\"bytes,3,opt,name=end_key,json=endKey,proto3,casttype=github.com/cockroachdb/cockroach/roachpb.Key\" json:\"end_key,omitempty\"`\n\tStartTime cockroach_util_hlc.Timestamp                 `protobuf:\"bytes,4,opt,name=start_time,json=startTime\" json:\"start_time\"`\n\tCRC       uint32                                       `protobuf:\"varint,5,opt,name=crc,proto3\" json:\"crc,omitempty\"`\n}\n```\nBackupRangeDescriptor represents a file that contains the diff for a key range between two timestamps.\n\n```go\nfunc (*BackupRangeDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *BackupRangeDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *BackupRangeDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*BackupRangeDescriptor) ProtoMessage()\n```\n\n```go\nfunc (m *BackupRangeDescriptor) Reset()\n```\n\n```go\nfunc (m *BackupRangeDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *BackupRangeDescriptor) String() string\n```\n\n```go\nfunc (m *BackupRangeDescriptor) Unmarshal(data []byte) error\n```\n\n```go\ntype ColumnDescriptor struct {\n\tName     string     `protobuf:\"bytes,1,opt,name=name\" json:\"name\"`\n\tID       ColumnID   `protobuf:\"varint,2,opt,name=id,casttype=ColumnID\" json:\"id\"`\n\tType     ColumnType `protobuf:\"bytes,3,opt,name=type\" json:\"type\"`\n\tNullable bool       `protobuf:\"varint,4,opt,name=nullable\" json:\"nullable\"`\n\t// Default expression to use to populate the column on insert if no\n\t// value is provided.\n\tDefaultExpr *string `protobuf:\"bytes,5,opt,name=default_expr,json=defaultExpr\" json:\"default_expr,omitempty\"`\n\tHidden      bool    `protobuf:\"varint,6,opt,name=hidden\" json:\"hidden\"`\n}\n```\n\n```go\nfunc (*ColumnDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *ColumnDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *ColumnDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*ColumnDescriptor) ProtoMessage()\n```\n\n```go\nfunc (m *ColumnDescriptor) Reset()\n```\n\n```go\nfunc (m *ColumnDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *ColumnDescriptor) String() string\n```\n\n```go\nfunc (m *ColumnDescriptor) Unmarshal(data []byte) error\n```\n\n```go\ntype ColumnFamilyDescriptor struct {\n\tName string   `protobuf:\"bytes,1,opt,name=name\" json:\"name\"`\n\tID   FamilyID `protobuf:\"varint,2,opt,name=id,casttype=FamilyID\" json:\"id\"`\n\t// A list of column names of which the family is comprised. This list\n\t// parallels the column_ids list. If duplicating the storage of the column\n\t// names here proves to be prohibitive, we could clear this field before\n\t// saving and reconstruct it after loading.\n\tColumnNames []string `protobuf:\"bytes,3,rep,name=column_names,json=columnNames\" json:\"column_names,omitempty\"`\n\t// A list of column ids of which the family is comprised. This list parallels\n\t// the column_names list.\n\tColumnIDs []ColumnID `protobuf:\"varint,4,rep,name=column_ids,json=columnIds,casttype=ColumnID\" json:\"column_ids,omitempty\"`\n\t// If nonzero, the column involved in the single column optimization.\n\t//\n\t// Families store colums in a ValueType_TUPLE as repeated \u003ccolid\u003e\u003cdata\u003e\n\t// entries. As a space optimization and for backward compatibility, a single\n\t// column is written without the columnid prefix. Because more columns could\n\t// be added, it would be ambiguous which column was stored when read back in,\n\t// so this field supplies it.\n\tDefaultColumnID ColumnID `protobuf:\"varint,5,opt,name=default_column_id,json=defaultColumnId,casttype=ColumnID\" json:\"default_column_id\"`\n}\n```\nColumnFamilyDescriptor is set of columns stored together in one kv entry.\n\n```go\nfunc (*ColumnFamilyDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *ColumnFamilyDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *ColumnFamilyDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*ColumnFamilyDescriptor) ProtoMessage()\n```\n\n```go\nfunc (m *ColumnFamilyDescriptor) Reset()\n```\n\n```go\nfunc (m *ColumnFamilyDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *ColumnFamilyDescriptor) String() string\n```\n\n```go\nfunc (m *ColumnFamilyDescriptor) Unmarshal(data []byte) error\n```\n\n```go\ntype ColumnID uint32\n```\nColumnID is a custom type for ColumnDescriptor IDs.\n\n```go\ntype ColumnOrderInfo struct {\n\tColIdx    int\n\tDirection encoding.Direction\n}\n```\nColumnOrderInfo describes a column (as an index) and a desired order direction.\n\n```go\ntype ColumnOrdering []ColumnOrderInfo\n```\nColumnOrdering is used to describe a desired column ordering. For example,\n\n\t[]ColumnOrderInfo{ {3, true}, {1, false} }\n\nrepresents an ordering first by column 3 (descending), then by column 1 (ascending).\n\n```go\ntype ColumnType struct {\n\tKind ColumnType_Kind `protobuf:\"varint,1,opt,name=kind,enum=cockroach.sql.sqlbase.ColumnType_Kind\" json:\"kind\"`\n\t// BIT, INT, FLOAT, DECIMAL, CHAR and BINARY\n\tWidth int32 `protobuf:\"varint,2,opt,name=width\" json:\"width\"`\n\t// FLOAT and DECIMAL.\n\tPrecision int32 `protobuf:\"varint,3,opt,name=precision\" json:\"precision\"`\n}\n```\n\n```go\nfunc (*ColumnType) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *ColumnType) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *ColumnType) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (c *ColumnType) MaxCharacterLength() (int32, bool)\n```\nMaxCharacterLength returns the declared maximum length of characters if the ColumnType is a character or bit string data type. Returns false if the data type is not a character or bit string, or if the string's length is not bounded.\n\n```go\nfunc (c *ColumnType) MaxOctetLength() (int32, bool)\n```\nMaxOctetLength returns the maximum the maximum possible length in octets of a datum if the ColumnType is a character string. Returns false if the data type is not a character string, or if the string's length is not bounded.\n\n```go\nfunc (c *ColumnType) NumericPrecision() (int32, bool)\n```\nNumericPrecision returns the declared or implicit precision of numeric data types. Returns false if the data type is not numeric, or if the precision of the numeric type is not bounded.\n\n```go\nfunc (c *ColumnType) NumericScale() (int32, bool)\n```\nNumericScale returns the declared or implicit precision of exact numeric data types. Returns false if the data type is not an exact numeric, or if the scale of the exact numeric type is not bounded.\n\n```go\nfunc (*ColumnType) ProtoMessage()\n```\n\n```go\nfunc (m *ColumnType) Reset()\n```\n\n```go\nfunc (c *ColumnType) SQLString() string\n```\nSQLString returns the SQL string corresponding to the type.\n\n```go\nfunc (m *ColumnType) Size() (n int)\n```\n\n```go\nfunc (m *ColumnType) String() string\n```\n\n```go\nfunc (c *ColumnType) ToDatumType() parser.Datum\n```\nToDatumType converts the ColumnType to the correct type Datum, or nil if there is no correspondence.\n\n```go\nfunc (m *ColumnType) Unmarshal(data []byte) error\n```\n\n```go\ntype ColumnType_Kind int32\n```\nThese mirror the types supported by the sql/parser. See sql/parser/types.go.\n\n```go\nconst (\n\tColumnType_BOOL        ColumnType_Kind = 0\n\tColumnType_INT         ColumnType_Kind = 1\n\tColumnType_FLOAT       ColumnType_Kind = 2\n\tColumnType_DECIMAL     ColumnType_Kind = 3\n\tColumnType_DATE        ColumnType_Kind = 4\n\tColumnType_TIMESTAMP   ColumnType_Kind = 5\n\tColumnType_INTERVAL    ColumnType_Kind = 6\n\tColumnType_STRING      ColumnType_Kind = 7\n\tColumnType_BYTES       ColumnType_Kind = 8\n\tColumnType_TIMESTAMPTZ ColumnType_Kind = 9\n)\n```\n\n```go\nfunc RandColumnType(rng *rand.Rand) ColumnType_Kind\n```\nRandColumnType returns a random ColumnType\\_Kind value.\n\n```go\nfunc (x ColumnType_Kind) Enum() *ColumnType_Kind\n```\n\n```go\nfunc (ColumnType_Kind) EnumDescriptor() ([]byte, []int)\n```\n\n```go\nfunc (x ColumnType_Kind) String() string\n```\n\n```go\nfunc (k ColumnType_Kind) ToDatumType() parser.Datum\n```\nToDatumType converts the ColumnType\\_Kind to the correct type Datum, or nil if there is no correspondence.\n\n```go\nfunc (x *ColumnType_Kind) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype ConstraintDetail struct {\n\tKind        ConstraintType\n\tColumns     []string\n\tDetails     string\n\tUnvalidated bool\n}\n```\nConstraintDetail describes a constraint.\n\n```go\ntype ConstraintType string\n```\nConstraintType is used to itentify the type of a constraint.\n\n```go\nconst (\n\t// ConstraintTypePK identifies a PRIMARY KEY constraint.\n\tConstraintTypePK ConstraintType = \"PRIMARY KEY\"\n\t// ConstraintTypeFK identifies a FOREIGN KEY constraint.\n\tConstraintTypeFK ConstraintType = \"FOREIGN KEY\"\n\t// ConstraintTypeUnique identifies a FOREIGN constraint.\n\tConstraintTypeUnique ConstraintType = \"UNIQUE\"\n\t// ConstraintTypeCheck identifies a CHECK constraint.\n\tConstraintTypeCheck ConstraintType = \"CHECK\"\n)\n```\n\n```go\ntype ConstraintValidity int32\n```\n\n```go\nconst (\n\tConstraintValidity_Validated   ConstraintValidity = 0\n\tConstraintValidity_Unvalidated ConstraintValidity = 1\n)\n```\n\n```go\nfunc (x ConstraintValidity) Enum() *ConstraintValidity\n```\n\n```go\nfunc (ConstraintValidity) EnumDescriptor() ([]byte, []int)\n```\n\n```go\nfunc (x ConstraintValidity) String() string\n```\n\n```go\nfunc (x *ConstraintValidity) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype DatabaseDescriptor struct {\n\tName       string               `protobuf:\"bytes,1,opt,name=name\" json:\"name\"`\n\tID         ID                   `protobuf:\"varint,2,opt,name=id,casttype=ID\" json:\"id\"`\n\tPrivileges *PrivilegeDescriptor `protobuf:\"bytes,3,opt,name=privileges\" json:\"privileges,omitempty\"`\n}\n```\nDatabaseDescriptor represents a namespace (aka database) and is stored in a structured metadata key. The DatabaseDescriptor has a globally-unique ID shared with the TableDescriptor ID. Permissions are applied to all tables in the namespace.\n\n```go\nfunc (*DatabaseDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *DatabaseDescriptor) GetID() ID\n```\n\n```go\nfunc (m *DatabaseDescriptor) GetName() string\n```\n\n```go\nfunc (m *DatabaseDescriptor) GetPrivileges() *PrivilegeDescriptor\n```\n\n```go\nfunc (m *DatabaseDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *DatabaseDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*DatabaseDescriptor) ProtoMessage()\n```\n\n```go\nfunc (m *DatabaseDescriptor) Reset()\n```\n\n```go\nfunc (desc *DatabaseDescriptor) SetID(id ID)\n```\nSetID implements the DescriptorProto interface.\n\n```go\nfunc (desc *DatabaseDescriptor) SetName(name string)\n```\nSetName implements the DescriptorProto interface.\n\n```go\nfunc (m *DatabaseDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *DatabaseDescriptor) String() string\n```\n\n```go\nfunc (desc *DatabaseDescriptor) TypeName() string\n```\nTypeName returns the plain type of this descriptor.\n\n```go\nfunc (m *DatabaseDescriptor) Unmarshal(data []byte) error\n```\n\n```go\nfunc (desc *DatabaseDescriptor) Validate() error\n```\nValidate validates that the database descriptor is well formed. Checks include validate the database name, and verifying that there is at least one read and write user.\n\n```go\ntype DatumAlloc struct {\n\t// contains filtered or unexported fields\n}\n```\nDatumAlloc provides batch allocation of datum pointers, amortizing the cost of the allocations.\n\n```go\nfunc (a *DatumAlloc) NewDBytes(v parser.DBytes) *parser.DBytes\n```\nNewDBytes allocates a DBytes.\n\n```go\nfunc (a *DatumAlloc) NewDDate(v parser.DDate) *parser.DDate\n```\nNewDDate allocates a DDate.\n\n```go\nfunc (a *DatumAlloc) NewDDecimal(v parser.DDecimal) *parser.DDecimal\n```\nNewDDecimal allocates a DDecimal.\n\n```go\nfunc (a *DatumAlloc) NewDFloat(v parser.DFloat) *parser.DFloat\n```\nNewDFloat allocates a DFloat.\n\n```go\nfunc (a *DatumAlloc) NewDInt(v parser.DInt) *parser.DInt\n```\nNewDInt allocates a DInt.\n\n```go\nfunc (a *DatumAlloc) NewDInterval(v parser.DInterval) *parser.DInterval\n```\nNewDInterval allocates a DInterval.\n\n```go\nfunc (a *DatumAlloc) NewDString(v parser.DString) *parser.DString\n```\nNewDString allocates a DString.\n\n```go\nfunc (a *DatumAlloc) NewDTimestamp(v parser.DTimestamp) *parser.DTimestamp\n```\nNewDTimestamp allocates a DTimestamp.\n\n```go\nfunc (a *DatumAlloc) NewDTimestampTZ(v parser.DTimestampTZ) *parser.DTimestampTZ\n```\nNewDTimestampTZ allocates a DTimestampTZ.\n\n```go\ntype DatumEncoding int32\n```\nDatumEncoding identifies the encoding used for an EncDatum.\n\n```go\nconst (\n\t// Indicates that the datum is encoded using the order-preserving encoding\n\t// used for keys (ascending order).\n\tDatumEncoding_ASCENDING_KEY DatumEncoding = 0\n\t// Indicates that the datum is encoded using the order-preserving encoding\n\t// used for keys (descending order).\n\tDatumEncoding_DESCENDING_KEY DatumEncoding = 1\n\t// Indicates that the datum is encoded using the encoding used for values.\n\tDatumEncoding_VALUE DatumEncoding = 2\n)\n```\n\n```go\nfunc RandDatumEncoding(rng *rand.Rand) DatumEncoding\n```\nRandDatumEncoding returns a random DatumEncoding value.\n\n```go\nfunc (x DatumEncoding) Enum() *DatumEncoding\n```\n\n```go\nfunc (DatumEncoding) EnumDescriptor() ([]byte, []int)\n```\n\n```go\nfunc (x DatumEncoding) String() string\n```\n\n```go\nfunc (x *DatumEncoding) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype Descriptor struct {\n\t// Types that are valid to be assigned to Union:\n\t//\t*Descriptor_Table\n\t//\t*Descriptor_Database\n\tUnion isDescriptor_Union `protobuf_oneof:\"union\"`\n}\n```\nDescriptor is a union type holding either a table or database descriptor.\n\n```go\nfunc WrapDescriptor(descriptor DescriptorProto) *Descriptor\n```\nWrapDescriptor fills in a Descriptor.\n\n```go\nfunc (*Descriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *Descriptor) GetDatabase() *DatabaseDescriptor\n```\n\n```go\nfunc (desc *Descriptor) GetID() ID\n```\nGetID returns the ID of the descriptor.\n\n```go\nfunc (desc *Descriptor) GetName() string\n```\nGetName returns the Name of the descriptor.\n\n```go\nfunc (m *Descriptor) GetTable() *TableDescriptor\n```\n\n```go\nfunc (m *Descriptor) GetUnion() isDescriptor_Union\n```\n\n```go\nfunc (m *Descriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *Descriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*Descriptor) ProtoMessage()\n```\n\n```go\nfunc (m *Descriptor) Reset()\n```\n\n```go\nfunc (m *Descriptor) Size() (n int)\n```\n\n```go\nfunc (m *Descriptor) String() string\n```\n\n```go\nfunc (m *Descriptor) Unmarshal(data []byte) error\n```\n\n```go\nfunc (*Descriptor) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})\n```\nXXX\\_OneofFuncs is for the internal use of the proto package.\n\n```go\ntype DescriptorKey interface {\n\tKey() roachpb.Key\n\tName() string\n}\n```\nDescriptorKey is the interface implemented by both databaseKey and tableKey. It is used to easily get the descriptor key and plain name.\n\n```go\ntype DescriptorMutation struct {\n\t// Types that are valid to be assigned to Descriptor_:\n\t//\t*DescriptorMutation_Column\n\t//\t*DescriptorMutation_Index\n\tDescriptor_ isDescriptorMutation_Descriptor_ `protobuf_oneof:\"descriptor\"`\n\tState       DescriptorMutation_State         `protobuf:\"varint,3,opt,name=state,enum=cockroach.sql.sqlbase.DescriptorMutation_State\" json:\"state\"`\n\tDirection   DescriptorMutation_Direction     `protobuf:\"varint,4,opt,name=direction,enum=cockroach.sql.sqlbase.DescriptorMutation_Direction\" json:\"direction\"`\n\t// The mutation id used to group mutations that should be applied together.\n\t// This is used for situations like creating a unique column, which\n\t// involve adding two mutations: one for the column, and another for the\n\t// unique constraint index.\n\tMutationID MutationID `protobuf:\"varint,5,opt,name=mutation_id,json=mutationId,casttype=MutationID\" json:\"mutation_id\"`\n}\n```\nA 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. A table descriptor in the middle of a schema change will have a DescriptorMutation FIFO queue containing each column/index descriptor being added or dropped.\n\n```go\nfunc (*DescriptorMutation) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *DescriptorMutation) GetColumn() *ColumnDescriptor\n```\n\n```go\nfunc (m *DescriptorMutation) GetDescriptor_() isDescriptorMutation_Descriptor_\n```\n\n```go\nfunc (m *DescriptorMutation) GetIndex() *IndexDescriptor\n```\n\n```go\nfunc (m *DescriptorMutation) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *DescriptorMutation) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*DescriptorMutation) ProtoMessage()\n```\n\n```go\nfunc (m *DescriptorMutation) Reset()\n```\n\n```go\nfunc (m *DescriptorMutation) Size() (n int)\n```\n\n```go\nfunc (m *DescriptorMutation) String() string\n```\n\n```go\nfunc (m *DescriptorMutation) Unmarshal(data []byte) error\n```\n\n```go\nfunc (*DescriptorMutation) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})\n```\nXXX\\_OneofFuncs is for the internal use of the proto package.\n\n```go\ntype DescriptorMutation_Column struct {\n\tColumn *ColumnDescriptor `protobuf:\"bytes,1,opt,name=column,oneof\"`\n}\n```\n\n```go\nfunc (m *DescriptorMutation_Column) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (m *DescriptorMutation_Column) Size() (n int)\n```\n\n```go\ntype DescriptorMutation_Direction int32\n```\nDirection of mutation.\n\n```go\nconst (\n\t// Not used.\n\tDescriptorMutation_NONE DescriptorMutation_Direction = 0\n\t// Descriptor is being added.\n\tDescriptorMutation_ADD DescriptorMutation_Direction = 1\n\t// Descriptor is being dropped.\n\tDescriptorMutation_DROP DescriptorMutation_Direction = 2\n)\n```\n\n```go\nfunc (x DescriptorMutation_Direction) Enum() *DescriptorMutation_Direction\n```\n\n```go\nfunc (DescriptorMutation_Direction) EnumDescriptor() ([]byte, []int)\n```\n\n```go\nfunc (x DescriptorMutation_Direction) String() string\n```\n\n```go\nfunc (x *DescriptorMutation_Direction) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype DescriptorMutation_Index struct {\n\tIndex *IndexDescriptor `protobuf:\"bytes,2,opt,name=index,oneof\"`\n}\n```\n\n```go\nfunc (m *DescriptorMutation_Index) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (m *DescriptorMutation_Index) Size() (n int)\n```\n\n```go\ntype DescriptorMutation_State int32\n```\nA descriptor within a mutation is unavailable for reads, writes and deletes. It is only available for implicit (internal to the database) writes and deletes depending on the state of the mutation.\n\n```go\nconst (\n\t// Not used.\n\tDescriptorMutation_UNKNOWN DescriptorMutation_State = 0\n\t// Operations can use this invisible descriptor to implicitly\n\t// delete entries.\n\t// Column: A descriptor in this state is invisible to\n\t// INSERT and UPDATE. DELETE must delete a column in this state.\n\t// Index: A descriptor in this state is invisible to an INSERT.\n\t// UPDATE must delete the old value of the index but doesn't write\n\t// the new value. DELETE must delete the index.\n\t//\n\t// When deleting a descriptor, all descriptor related data\n\t// (column or index data) can only be mass deleted once\n\t// all the nodes have transitioned to the DELETE_ONLY state.\n\tDescriptorMutation_DELETE_ONLY DescriptorMutation_State = 1\n\t// Operations can use this invisible descriptor to implicitly\n\t// write and delete entries.\n\t// Column: INSERT will populate this column with the default\n\t// value. UPDATE ignores this descriptor. DELETE must delete\n\t// the column.\n\t// Index: INSERT, UPDATE and DELETE treat this index like any\n\t// other index.\n\t//\n\t// When adding a descriptor, all descriptor related data\n\t// (column default or index data) can only be backfilled once\n\t// all nodes have transitioned into the WRITE_ONLY state.\n\tDescriptorMutation_WRITE_ONLY DescriptorMutation_State = 2\n)\n```\n\n```go\nfunc (x DescriptorMutation_State) Enum() *DescriptorMutation_State\n```\n\n```go\nfunc (DescriptorMutation_State) EnumDescriptor() ([]byte, []int)\n```\n\n```go\nfunc (x DescriptorMutation_State) String() string\n```\n\n```go\nfunc (x *DescriptorMutation_State) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype DescriptorProto interface {\n\tproto.Message\n\tGetPrivileges() *PrivilegeDescriptor\n\tGetID() ID\n\tSetID(ID)\n\tTypeName() string\n\tGetName() string\n\tSetName(string)\n}\n```\nDescriptorProto is the interface implemented by both DatabaseDescriptor and TableDescriptor. TODO(marc): this is getting rather large.\n\n```go\ntype DescriptorStatus int\n```\nDescriptorStatus is the status for a descriptor.\n\n```go\nconst (\n\n\t// DescriptorAbsent for a descriptor that doesn't exist.\n\tDescriptorAbsent DescriptorStatus\n\t// DescriptorIncomplete for a descriptor that is a part of a\n\t// schema change, and is still being processed.\n\tDescriptorIncomplete\n\t// DescriptorActive for a descriptor that is completely active\n\t// for read/write and delete operations.\n\tDescriptorActive\n)\n```\n\n```go\ntype DescriptorVersion uint32\n```\nDescriptorVersion is a custom type for TableDescriptor Versions.\n\n```go\ntype Descriptor_Database struct {\n\tDatabase *DatabaseDescriptor `protobuf:\"bytes,2,opt,name=database,oneof\"`\n}\n```\n\n```go\nfunc (m *Descriptor_Database) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (m *Descriptor_Database) Size() (n int)\n```\n\n```go\ntype Descriptor_Table struct {\n\tTable *TableDescriptor `protobuf:\"bytes,1,opt,name=table,oneof\"`\n}\n```\n\n```go\nfunc (m *Descriptor_Table) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (m *Descriptor_Table) Size() (n int)\n```\n\n```go\ntype EncDatum struct {\n\tType ColumnType_Kind\n\n\t// Decoded datum.\n\tDatum parser.Datum\n\t// contains filtered or unexported fields\n}\n```\nEncDatum represents a datum that is \"backed\" by an encoding and/or by a parser.Datum. It allows \"passing through\" a Datum without decoding and reencoding. TODO(radu): It will also allow comparing encoded datums directly (for certain encodings).\n\n```go\nfunc RandEncDatum(rng *rand.Rand) EncDatum\n```\nRandEncDatum generates a random EncDatum (of a random type).\n\n```go\nfunc RandEncDatumSlice(rng *rand.Rand, numVals int) []EncDatum\n```\nRandEncDatumSlice generates a slice of random EncDatum values of the same random type.\n\n```go\nfunc (ed *EncDatum) Compare(a *DatumAlloc, rhs *EncDatum) (int, error)\n```\nCompare returns:\n\n\t-1 if the receiver is less than rhs,\n\t0  if the receiver is equal to rhs,\n\t+1 if the receiver is greater than rhs.\n\n```go\nfunc (ed *EncDatum) Decode(a *DatumAlloc) error\n```\nDecode ensures that Datum is set (decoding if necessary).\n\n```go\nfunc (ed *EncDatum) Encode(a *DatumAlloc, enc DatumEncoding, appendTo []byte) ([]byte, error)\n```\nEncode appends the encoded datum to the given slice using the requested encoding.\n\n```go\nfunc (ed *EncDatum) Encoding() (DatumEncoding, bool)\n```\nEncoding returns the encoding that is already available (the latter indicated by the bool return value).\n\n```go\nfunc (ed *EncDatum) IsUnset() bool\n```\nIsUnset returns true if SetEncoded or SetDatum were not called.\n\n```go\nfunc (ed *EncDatum) SetDatum(typ ColumnType_Kind, d parser.Datum)\n```\nSetDatum initializes the EncDatum with the given Datum.\n\n```go\nfunc (ed *EncDatum) SetEncoded(typ ColumnType_Kind, enc DatumEncoding, val []byte)\n```\nSetEncoded initializes the EncDatum with the given encoded value. The encoded value is stored as a shallow copy, so the caller must make sure the slice is not modified for the lifetime of the EncDatum.\n\n```go\nfunc (ed *EncDatum) SetFromBuffer(\n\ttyp ColumnType_Kind, enc DatumEncoding, buf []byte,\n) (remaining []byte, err error)\n```\nSetFromBuffer initializes the EncDatum with an encoding that is possibly followed by other data. Similar to SetEncoded, except that this function figures out where the encoding stops and returns a slice for the rest of the buffer.\n\n```go\nfunc (ed *EncDatum) String() string\n```\n\n```go\ntype EncDatumRow []EncDatum\n```\nEncDatumRow is a row of EncDatums.\n\n```go\nfunc (r EncDatumRow) Compare(a *DatumAlloc, ordering ColumnOrdering, rhs EncDatumRow) (int, error)\n```\nCompare returns the relative ordering of two EncDatumRows according to a ColumnOrdering:\n\n\t-1 if the receiver comes before the rhs in the ordering,\n\t+1 if the receiver comes after the rhs in the ordering,\n\t0 if the relative order does not matter (i.e. the two rows have the same\n\t  values for the columns in the ordering).\n\nNote that a return value of 0 does not (in general) imply that the rows are equal; for example, rows \\[1 1 5] and \\[1 1 6] when compared against ordering {{0, asc}, {1, asc}} (i.e. ordered by first column and then by second column).\n\n```go\nfunc (r EncDatumRow) String() string\n```\n\n```go\ntype EncDatumRowAlloc struct {\n\t// contains filtered or unexported fields\n}\n```\nEncDatumRowAlloc is a helper that speeds up allocation of EncDatumRows (preferably of the same length).\n\n```go\nfunc (a *EncDatumRowAlloc) AllocRow(cols int) EncDatumRow\n```\nAllocRow allocates an EncDatumRow with the given number of columns.\n\n```go\nfunc (a *EncDatumRowAlloc) CopyRow(row EncDatumRow) EncDatumRow\n```\nCopyRow allocates an EncDatumRow and copies the given row to it.\n\n```go\ntype EncDatumRows []EncDatumRow\n```\nEncDatumRows is a slice of EncDatumRows.\n\n```go\nfunc (r EncDatumRows) String() string\n```\n\n```go\ntype ErrDatabaseAlreadyExists struct {\n\t// contains filtered or unexported fields\n}\n```\nErrDatabaseAlreadyExists represents a missing database error.\n\n```go\nfunc (*ErrDatabaseAlreadyExists) Code() string\n```\nCode implements the ErrorWithPGCode interface.\n\n```go\nfunc (e *ErrDatabaseAlreadyExists) Error() string\n```\n\n```go\nfunc (e *ErrDatabaseAlreadyExists) SrcContext() SrcCtx\n```\nSrcContext implements the ErrorWithPGCode interface.\n\n```go\ntype ErrNonNullViolation struct {\n\t// contains filtered or unexported fields\n}\n```\nErrNonNullViolation represents a violation of a non-NULL constraint.\n\n```go\nfunc (*ErrNonNullViolation) Code() string\n```\nCode implements the ErrorWithPGCode interface.\n\n```go\nfunc (e *ErrNonNullViolation) Error() string\n```\n\n```go\nfunc (e *ErrNonNullViolation) SrcContext() SrcCtx\n```\nSrcContext implements the ErrorWithPGCode interface.\n\n```go\ntype ErrRelationAlreadyExists struct {\n\t// contains filtered or unexported fields\n}\n```\nErrRelationAlreadyExists represents a missing database error.\n\n```go\nfunc (*ErrRelationAlreadyExists) Code() string\n```\nCode implements the ErrorWithPGCode interface.\n\n```go\nfunc (e *ErrRelationAlreadyExists) Error() string\n```\n\n```go\nfunc (e *ErrRelationAlreadyExists) SrcContext() SrcCtx\n```\nSrcContext implements the ErrorWithPGCode interface.\n\n```go\ntype ErrRetry struct {\n\t// contains filtered or unexported fields\n}\n```\nErrRetry means that the transaction can be retried. It signals to the user that the SQL txn entered the RESTART\\_WAIT state after a serialization error, and that a ROLLBACK TO SAVEPOINT COCKROACH\\_RESTART statement should be issued.\n\n```go\nfunc (*ErrRetry) Code() string\n```\nCode implements the ErrorWithPGCode interface.\n\n```go\nfunc (e *ErrRetry) Error() string\n```\n\n```go\nfunc (e *ErrRetry) SrcContext() SrcCtx\n```\nSrcContext implements the ErrorWithPGCode interface.\n\n```go\ntype ErrSyntax struct {\n\t// contains filtered or unexported fields\n}\n```\nErrSyntax represents a syntax error.\n\n```go\nfunc (*ErrSyntax) Code() string\n```\nCode implements the ErrorWithPGCode interface.\n\n```go\nfunc (e *ErrSyntax) Error() string\n```\n\n```go\nfunc (e *ErrSyntax) SrcContext() SrcCtx\n```\nSrcContext implements the ErrorWithPGCode interface.\n\n```go\ntype ErrTransactionAborted struct {\n\tCustomMsg string\n\t// contains filtered or unexported fields\n}\n```\nErrTransactionAborted represents an error for trying to run a command in the context of transaction that's already aborted.\n\n```go\nfunc (*ErrTransactionAborted) Code() string\n```\nCode implements the ErrorWithPGCode interface.\n\n```go\nfunc (e *ErrTransactionAborted) Error() string\n```\n\n```go\nfunc (e *ErrTransactionAborted) SrcContext() SrcCtx\n```\nSrcContext implements the ErrorWithPGCode interface.\n\n```go\ntype ErrTransactionCommitted struct {\n\t// contains filtered or unexported fields\n}\n```\nErrTransactionCommitted signals that the SQL txn is in the COMMIT\\_WAIT state and that only a COMMIT statement will be accepted.\n\n```go\nfunc (*ErrTransactionCommitted) Code() string\n```\nCode implements the ErrorWithPGCode interface.\n\n```go\nfunc (*ErrTransactionCommitted) Error() string\n```\n\n```go\nfunc (e *ErrTransactionCommitted) SrcContext() SrcCtx\n```\nSrcContext implements the ErrorWithPGCode interface.\n\n```go\ntype ErrUndefinedDatabase struct {\n\t// contains filtered or unexported fields\n}\n```\nErrUndefinedDatabase represents a missing database error.\n\n```go\nfunc (*ErrUndefinedDatabase) Code() string\n```\nCode implements the ErrorWithPGCode interface.\n\n```go\nfunc (e *ErrUndefinedDatabase) Error() string\n```\n\n```go\nfunc (e *ErrUndefinedDatabase) SrcContext() SrcCtx\n```\nSrcContext implements the ErrorWithPGCode interface.\n\n```go\ntype ErrUndefinedTable struct {\n\t// contains filtered or unexported fields\n}\n```\nErrUndefinedTable represents a missing database table.\n\n```go\nfunc (*ErrUndefinedTable) Code() string\n```\nCode implements the ErrorWithPGCode interface.\n\n```go\nfunc (e *ErrUndefinedTable) Error() string\n```\n\n```go\nfunc (e *ErrUndefinedTable) SrcContext() SrcCtx\n```\nSrcContext implements the ErrorWithPGCode interface.\n\n```go\ntype ErrUniquenessConstraintViolation struct {\n\t// contains filtered or unexported fields\n}\n```\nErrUniquenessConstraintViolation represents a violation of a UNIQUE constraint.\n\n```go\nfunc (*ErrUniquenessConstraintViolation) Code() string\n```\nCode implements the ErrorWithPGCode interface.\n\n```go\nfunc (e *ErrUniquenessConstraintViolation) Error() string\n```\n\n```go\nfunc (e *ErrUniquenessConstraintViolation) SrcContext() SrcCtx\n```\nSrcContext implements the ErrorWithPGCode interface.\n\n```go\ntype ErrWrongObjectType struct {\n\t// contains filtered or unexported fields\n}\n```\nErrWrongObjectType represents a wrong object type error.\n\n```go\nfunc (*ErrWrongObjectType) Code() string\n```\nCode implements the ErrorWithPGCode interface.\n\n```go\nfunc (e *ErrWrongObjectType) Error() string\n```\n\n```go\nfunc (e *ErrWrongObjectType) SrcContext() SrcCtx\n```\nSrcContext implements the ErrorWithPGCode interface.\n\n```go\ntype ErrorWithPGCode interface {\n\terror\n\tCode() string\n\tSrcContext() SrcCtx\n}\n```\nErrorWithPGCode represents errors that carries an error code to the user. pgwire recognizes this interfaces and extracts the code.\n\n```go\ntype FamilyID uint32\n```\nFamilyID is a custom type for ColumnFamilyDescriptor IDs.\n\n```go\ntype ForeignKeyReference struct {\n\tTable    ID                 `protobuf:\"varint,1,opt,name=table,casttype=ID\" json:\"table\"`\n\tIndex    IndexID            `protobuf:\"varint,2,opt,name=index,casttype=IndexID\" json:\"index\"`\n\tName     string             `protobuf:\"bytes,3,opt,name=name\" json:\"name\"`\n\tValidity ConstraintValidity `protobuf:\"varint,4,opt,name=validity,enum=cockroach.sql.sqlbase.ConstraintValidity\" json:\"validity\"`\n}\n```\n\n```go\nfunc (*ForeignKeyReference) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (f ForeignKeyReference) IsSet() bool\n```\nIsSet returns whether or not the foreign key actually references a table.\n\n```go\nfunc (m *ForeignKeyReference) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *ForeignKeyReference) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*ForeignKeyReference) ProtoMessage()\n```\n\n```go\nfunc (m *ForeignKeyReference) Reset()\n```\n\n```go\nfunc (m *ForeignKeyReference) Size() (n int)\n```\n\n```go\nfunc (m *ForeignKeyReference) String() string\n```\n\n```go\nfunc (m *ForeignKeyReference) Unmarshal(data []byte) error\n```\n\n```go\ntype FormatVersion uint32\n```\nFormatVersion is a custom type for TableDescriptor versions of the sql to key:value mapping.\n\n```go\nconst (\n\n\t// BaseFormatVersion corresponds to the encoding described in\n\t// https://www.cockroachlabs.com/blog/sql-in-cockroachdb-mapping-table-data-to-key-value-storage/.\n\tBaseFormatVersion FormatVersion\n\t// FamilyFormatVersion corresponds to the encoding described in\n\t// https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/sql_column_families.md\n\tFamilyFormatVersion\n\t// InterleavedFormatVersion corresponds to the encoding described in\n\t// https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/sql_interleaved_tables.md\n\tInterleavedFormatVersion\n)\n```\n\n```go\nfunc (i FormatVersion) String() string\n```\n\n```go\ntype ID uint32\n```\nID is a custom type for {Database,Table}Descriptor IDs.\n\n```go\ntype IndexDescriptor struct {\n\tName   string  `protobuf:\"bytes,1,opt,name=name\" json:\"name\"`\n\tID     IndexID `protobuf:\"varint,2,opt,name=id,casttype=IndexID\" json:\"id\"`\n\tUnique bool    `protobuf:\"varint,3,opt,name=unique\" json:\"unique\"`\n\t// An ordered list of column names of which the index is comprised. This list\n\t// parallels the column_ids list. If duplicating the storage of the column\n\t// names here proves to be prohibitive, we could clear this field before\n\t// saving and reconstruct it after loading.\n\tColumnNames []string `protobuf:\"bytes,4,rep,name=column_names,json=columnNames\" json:\"column_names,omitempty\"`\n\t// Parallel with column_names - the sort direction of each column.\n\tColumnDirections []IndexDescriptor_Direction `protobuf:\"varint,8,rep,name=column_directions,json=columnDirections,enum=cockroach.sql.sqlbase.IndexDescriptor_Direction\" json:\"column_directions,omitempty\"`\n\t// An ordered list of column names which the index stores in\n\t// addition to the columns which are explicitly part of the index.\n\tStoreColumnNames []string `protobuf:\"bytes,5,rep,name=store_column_names,json=storeColumnNames\" json:\"store_column_names,omitempty\"`\n\t// An ordered list of column ids of which the index is comprised. This list\n\t// parallels the column_names list.\n\tColumnIDs []ColumnID `protobuf:\"varint,6,rep,name=column_ids,json=columnIds,casttype=ColumnID\" json:\"column_ids,omitempty\"`\n\t// An ordered list of implicit column ids associated with the index. For\n\t// non-unique indexes, these columns will be appended to the key. For unique\n\t// indexes these columns will be stored in the value. The extra column IDs is\n\t// computed as PrimaryIndex.column_ids - column_ids. For the primary index\n\t// the list will be empty.\n\t// The distinction about whether the columns are written in the key or the value\n\t// comes because we want to always do writes using a single operation - this\n\t// way for unique indexes we can do a conditional put on the key.\n\tImplicitColumnIDs []ColumnID            `protobuf:\"varint,7,rep,name=implicit_column_ids,json=implicitColumnIds,casttype=ColumnID\" json:\"implicit_column_ids,omitempty\"`\n\tForeignKey        ForeignKeyReference   `protobuf:\"bytes,9,opt,name=foreign_key,json=foreignKey\" json:\"foreign_key\"`\n\tReferencedBy      []ForeignKeyReference `protobuf:\"bytes,10,rep,name=referenced_by,json=referencedBy\" json:\"referenced_by\"`\n\t// Interleave, if it's not the zero value, describes how this index's data is\n\t// interleaved into another index's data.\n\tInterleave InterleaveDescriptor `protobuf:\"bytes,11,opt,name=interleave\" json:\"interleave\"`\n\t// InterleavedBy contains a reference to every table/index that is interleaved\n\t// into this one.\n\tInterleavedBy []ForeignKeyReference `protobuf:\"bytes,12,rep,name=interleaved_by,json=interleavedBy\" json:\"interleaved_by\"`\n}\n```\n\n```go\nfunc (desc *IndexDescriptor) ContainsColumnID(colID ColumnID) bool\n```\nContainsColumnID returns true if the index descriptor contains the specified column ID either in its explicit column IDs or the implicit \"extra\" column IDs.\n\n```go\nfunc (*IndexDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (desc *IndexDescriptor) FillColumns(elems parser.IndexElemList) error\n```\nFillColumns sets the column names and directions in desc.\n\n```go\nfunc (desc *IndexDescriptor) FullColumnIDs() ([]ColumnID, []encoding.Direction)\n```\nFullColumnIDs returns the index column IDs including any implicit column IDs for non-unique indexes. It also returns the direction with which each column was encoded.\n\n```go\nfunc (m *IndexDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *IndexDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*IndexDescriptor) ProtoMessage()\n```\n\n```go\nfunc (m *IndexDescriptor) Reset()\n```\n\n```go\nfunc (m *IndexDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *IndexDescriptor) String() string\n```\n\n```go\nfunc (m *IndexDescriptor) Unmarshal(data []byte) error\n```\n\n```go\ntype IndexDescriptor_Direction int32\n```\nThe direction of a column in the index.\n\n```go\nconst (\n\tIndexDescriptor_ASC  IndexDescriptor_Direction = 0\n\tIndexDescriptor_DESC IndexDescriptor_Direction = 1\n)\n```\n\n```go\nfunc (x IndexDescriptor_Direction) Enum() *IndexDescriptor_Direction\n```\n\n```go\nfunc (IndexDescriptor_Direction) EnumDescriptor() ([]byte, []int)\n```\n\n```go\nfunc (x IndexDescriptor_Direction) String() string\n```\n\n```go\nfunc (dir IndexDescriptor_Direction) ToEncodingDirection() (encoding.Direction, error)\n```\nToEncodingDirection converts a direction from the proto to an encoding.Direction.\n\n```go\nfunc (x *IndexDescriptor_Direction) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype IndexEntry struct {\n\tKey   roachpb.Key\n\tValue roachpb.Value\n}\n```\nIndexEntry represents an encoded key/value for an index entry.\n\n```go\nfunc EncodeSecondaryIndex(\n\ttableDesc *TableDescriptor,\n\tsecondaryIndex *IndexDescriptor,\n\tcolMap map[ColumnID]int,\n\tvalues []parser.Datum,\n) (IndexEntry, error)\n```\nEncodeSecondaryIndex encodes key/values for a secondary index. colMap maps ColumnIDs to indices in \\`values\\`.\n\n```go\ntype IndexID uint32\n```\nIndexID is a custom type for IndexDescriptor IDs.\n\n```go\nfunc DecodeIndexKeyPrefix(\n\ta *DatumAlloc, desc *TableDescriptor, key []byte,\n) (indexID IndexID, remaining []byte, err error)\n```\nDecodeIndexKeyPrefix decodes the prefix of an index key and returns the index id and a slice for the rest of the key.\n\nDon't use this function in the scan \"hot path\".\n\n```go\ntype InterleaveDescriptor struct {\n\t// Ancestors contains the nesting of interleaves in the order they appear in\n\t// an encoded key. This means they are always in the far-to-near ancestor\n\t// order (e.g. grand-grand-parent, grand-parent, parent).\n\tAncestors []InterleaveDescriptor_Ancestor `protobuf:\"bytes,1,rep,name=ancestors\" json:\"ancestors\"`\n}\n```\nInterleaveDescriptor represents an index (either primary or secondary) that is interleaved into another table's data.\n\nExample: Table 1 -\u003e /a/b Table 2 -\u003e /a/b/c Table 3 -\u003e /a/b/c/d\n\nThere are two components (table 2 is the parent and table 1 is the grandparent) with shared lengths 2 and 1.\n\n```go\nfunc (*InterleaveDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *InterleaveDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *InterleaveDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*InterleaveDescriptor) ProtoMessage()\n```\n\n```go\nfunc (m *InterleaveDescriptor) Reset()\n```\n\n```go\nfunc (m *InterleaveDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *InterleaveDescriptor) String() string\n```\n\n```go\nfunc (m *InterleaveDescriptor) Unmarshal(data []byte) error\n```\n\n```go\ntype InterleaveDescriptor_Ancestor struct {\n\t// TableID the ID of the table being interleaved into.\n\tTableID ID `protobuf:\"varint,1,opt,name=table_id,json=tableId,casttype=ID\" json:\"table_id\"`\n\t// IndexID is the ID of the parent index being interleaved into.\n\tIndexID IndexID `protobuf:\"varint,2,opt,name=index_id,json=indexId,casttype=IndexID\" json:\"index_id\"`\n\t// SharedPrefixLen is how many fields are shared between a parent and child\n\t// being interleaved, excluding any fields shared between parent and\n\t// grandparent. Thus, the sum of SharedPrefixLens in the components of an\n\t// InterleaveDescriptor is always strictly less than the number of fields\n\t// in the index being interleaved.\n\tSharedPrefixLen uint32 `protobuf:\"varint,3,opt,name=shared_prefix_len,json=sharedPrefixLen\" json:\"shared_prefix_len\"`\n}\n```\n\n```go\nfunc (*InterleaveDescriptor_Ancestor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *InterleaveDescriptor_Ancestor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *InterleaveDescriptor_Ancestor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*InterleaveDescriptor_Ancestor) ProtoMessage()\n```\n\n```go\nfunc (m *InterleaveDescriptor_Ancestor) Reset()\n```\n\n```go\nfunc (m *InterleaveDescriptor_Ancestor) Size() (n int)\n```\n\n```go\nfunc (m *InterleaveDescriptor_Ancestor) String() string\n```\n\n```go\nfunc (m *InterleaveDescriptor_Ancestor) Unmarshal(data []byte) error\n```\n\n```go\ntype MetadataSchema struct {\n\t// contains filtered or unexported fields\n}\n```\nMetadataSchema is used to construct the initial sql schema for a new CockroachDB cluster being bootstrapped. Tables and databases must be installed on the underlying persistent storage before a cockroach store can start running correctly, thus requiring this special initialization.\n\n```go\nfunc MakeMetadataSchema() MetadataSchema\n```\nMakeMetadataSchema constructs a new MetadataSchema value which constructs the \"system\" database.\n\n```go\nfunc (ms *MetadataSchema) AddConfigDescriptor(parentID ID, desc DescriptorProto)\n```\nAddConfigDescriptor adds a new descriptor to the system schema. Used only for SystemConfig tables and databases.\n\n```go\nfunc (ms *MetadataSchema) AddDescriptor(parentID ID, desc DescriptorProto)\n```\nAddDescriptor adds a new non-config descriptor to the system schema.\n\n```go\nfunc (ms MetadataSchema) GetInitialValues() []roachpb.KeyValue\n```\nGetInitialValues returns the set of initial K/V values which should be added to a bootstrapping CockroachDB cluster in order to create the tables contained in the schema.\n\n```go\nfunc (ms MetadataSchema) SystemConfigDescriptorCount() int\n```\nSystemConfigDescriptorCount returns the number of config descriptors that will be created by this schema. This value is needed to automate certain tests.\n\n```go\nfunc (ms MetadataSchema) SystemDescriptorCount() int\n```\nSystemDescriptorCount returns the number of descriptors that will be created by this schema. This value is needed to automate certain tests.\n\n```go\ntype MutationID uint32\n```\nMutationID is custom type for TableDescriptor mutations.\n\n```go\nconst InvalidMutationID MutationID = 0\n```\nInvalidMutationID is the uninitialised mutation id.\n\n```go\ntype PrivilegeDescriptor struct {\n\tUsers []UserPrivileges `protobuf:\"bytes,1,rep,name=users\" json:\"users\"`\n}\n```\nPrivilegeDescriptor describes a list of users and attached privileges. The list should be sorted by user for fast access.\n\n```go\nfunc NewDefaultPrivilegeDescriptor() *PrivilegeDescriptor\n```\nNewDefaultPrivilegeDescriptor returns a privilege descriptor with ALL privileges for the root user.\n\n```go\nfunc NewPrivilegeDescriptor(user string, priv privilege.List) *PrivilegeDescriptor\n```\nNewPrivilegeDescriptor returns a privilege descriptor for the given user with the specified list of privileges.\n\n```go\nfunc (p PrivilegeDescriptor) AnyPrivilege(user string) bool\n```\nAnyPrivilege returns true if 'user' has any privilege on this descriptor.\n\n```go\nfunc (p PrivilegeDescriptor) CheckPrivilege(user string, priv privilege.Kind) bool\n```\nCheckPrivilege returns true if 'user' has 'privilege' on this descriptor.\n\n```go\nfunc (*PrivilegeDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (p *PrivilegeDescriptor) Grant(user string, privList privilege.List)\n```\nGrant adds new privileges to this descriptor for a given list of users. TODO(marc): if all privileges other than ALL are set, should we collapse them into ALL?\n\n```go\nfunc (m *PrivilegeDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *PrivilegeDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*PrivilegeDescriptor) ProtoMessage()\n```\n\n```go\nfunc (m *PrivilegeDescriptor) Reset()\n```\n\n```go\nfunc (p *PrivilegeDescriptor) Revoke(user string, privList privilege.List)\n```\nRevoke removes privileges from this descriptor for a given list of users.\n\n```go\nfunc (p PrivilegeDescriptor) Show() []UserPrivilegeString\n```\nShow returns the list of {username, privileges} sorted by username. 'privileges' is a string of comma-separated sorted privilege names.\n\n```go\nfunc (m *PrivilegeDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *PrivilegeDescriptor) String() string\n```\n\n```go\nfunc (m *PrivilegeDescriptor) Unmarshal(data []byte) error\n```\n\n```go\nfunc (p PrivilegeDescriptor) Validate(id ID) error\n```\nValidate is called when writing a database or table descriptor. It takes the descriptor ID which is used to determine if it belongs to a system descriptor, in which case the maximum set of allowed privileges is looked up and applied.\n\n```go\ntype RowFetcher struct {\n\t// contains filtered or unexported fields\n}\n```\nRowFetcher handles fetching kvs and forming table rows. Usage:\n\n\tvar rf RowFetcher\n\terr := rf.Init(..)\n\t// Handle err\n\terr := rf.StartScan(..)\n\t// Handle err\n\tfor {\n\t   row, err := rf.NextRow()\n\t   // Handle err\n\t   if row == nil {\n\t      // Done\n\t      break\n\t   }\n\t   // Process row\n\t}\n\n```go\nfunc (rf *RowFetcher) Init(\n\tdesc *TableDescriptor,\n\tcolIdxMap map[ColumnID]int,\n\tindex *IndexDescriptor,\n\treverse, isSecondaryIndex bool,\n\tcols []ColumnDescriptor,\n\tvalNeededForCol []bool,\n) error\n```\nInit sets up a RowFetcher for a given table and index. If we are using a non-primary index, valNeededForCol can only be true for the columns in the index.\n\n```go\nfunc (rf *RowFetcher) Key() roachpb.Key\n```\nKey returns the next key (the key that follows the last returned row).\n\n```go\nfunc (rf *RowFetcher) NextKey() (rowDone bool, err error)\n```\nNextKey retrieves the next key/value and sets kv/kvEnd. Returns whether a row has been completed. TODO(andrei): change to return error\n\n```go\nfunc (rf *RowFetcher) NextKeyDebug() (prettyKey string, prettyValue string, row parser.DTuple, err error)\n```\nNextKeyDebug processes one key at a time and returns a pretty printed key and value. If we completed a row, the row is returned as well (see nextRow). If there are no more keys, prettyKey is \"\".\n\n```go\nfunc (rf *RowFetcher) NextRow() (parser.DTuple, error)\n```\nNextRow processes keys until we complete one row, which is returned as a DTuple. The row contains one value per table column, regardless of the index used; values that are not needed (as per valNeededForCol) are nil.\n\nThe DTuple should not be modified and is only valid until the next call. When there are no more rows, the DTuple is nil.\n\n```go\nfunc (rf *RowFetcher) ProcessKV(\n\tkv client.KeyValue, debugStrings bool,\n) (prettyKey string, prettyValue string, err error)\n```\nProcessKV processes the given key/value, setting values in the row accordingly. If debugStrings is true, returns pretty printed key and value information in prettyKey/prettyValue (otherwise they are empty strings).\n\n```go\nfunc (rf *RowFetcher) ReadIndexKey(k roachpb.Key) (remaining []byte, ok bool, err error)\n```\nReadIndexKey decodes an index key for the fetcher's table.\n\n```go\nfunc (rf *RowFetcher) StartScan(\n\ttxn *client.Txn, spans roachpb.Spans, limitBatches bool, limitHint int64,\n) error\n```\nStartScan initializes and starts the key-value scan. Can be used multiple times.\n\n```go\ntype SrcCtx struct {\n\tFile     string\n\tLine     int\n\tFunction string\n}\n```\nSrcCtx contains contextual information about the source of an error.\n\n```go\nfunc MakeSrcCtx(depth int) SrcCtx\n```\nMakeSrcCtx creates a SrcCtx value with contextual information about the caller at the requested depth.\n\n```go\ntype TableDescriptor struct {\n\t// The table name. It should be normalized using sqlbase.NormalizeName()\n\t// before comparing it.\n\tName string `protobuf:\"bytes,1,opt,name=name\" json:\"name\"`\n\tID   ID     `protobuf:\"varint,3,opt,name=id,casttype=ID\" json:\"id\"`\n\t// ID of the parent database.\n\tParentID ID `protobuf:\"varint,4,opt,name=parent_id,json=parentId,casttype=ID\" json:\"parent_id\"`\n\t// Monotonically increasing version of the table descriptor.\n\t//\n\t// Invariants:\n\t// 1. not more than two subsequent versions of the table\n\t// descriptor can be leased. This is to make the system\n\t// easy to reason about, by permiting mutation state\n\t// changes (reflected in the next version), only when the existing\n\t// state (reflected in the current version) is present on all\n\t// outstanding unexpired leases.\n\t// 2. A schema change command (ALTER, RENAME, etc) never directly\n\t// increments the version. This allows the command to execute without\n\t// waiting for the entire cluster to converge to a single version\n\t// preventing weird deadlock situations. For instance, a transaction\n\t// with a schema change command might use a descriptor lease that is\n\t// at version: v - 1, and therefore deadlock when it tries to wait\n\t// for version: v, in the process of incrementing it to v + 1.\n\t// Therefore, a schema change command never increments the version,\n\t// and instead, sets the up_version boolean to notify the schema\n\t// changer execution engine that runs a future transaction to\n\t// increment the version.\n\t//\n\t// The schema change commands must therefore make *safe* modifications\n\t// to the table descriptor, such as scheduling long running schema\n\t// changes through mutations for future execution, or making simple\n\t// schema changes like RENAME that only modify the table descriptor in a\n\t// single transaction.\n\t//\n\t// Multiple schema changes in the same transaction set up_version.\n\t// The actual schema change execution that follows a schema change\n\t// command sees the up_version boolean set, and increments the\n\t// table version after ensuring that there are no unexpired leases\n\t// for version - 1. The schema change execution must increment\n\t// the version before executing future state changes, to ensure\n\t// that the scheduled mutations made by the original commands are\n\t// visible on all leases. Multiple schema change mutations can be\n\t// grouped together on a particular version increment.\n\t//\n\t// If schema change commands are safe to run without incrementing\n\t// the version, why do it later on? We increment the version\n\t// to ensure that all the nodes renew their leases with the new version\n\t// and get to see what the schema change command has done quickly.\n\tVersion DescriptorVersion `protobuf:\"varint,5,opt,name=version,casttype=DescriptorVersion\" json:\"version\"`\n\t// See comment above.\n\tUpVersion bool `protobuf:\"varint,6,opt,name=up_version,json=upVersion\" json:\"up_version\"`\n\t// Last modification time of the table descriptor.\n\tModificationTime cockroach_util_hlc.Timestamp `protobuf:\"bytes,7,opt,name=modification_time,json=modificationTime\" json:\"modification_time\"`\n\tColumns          []ColumnDescriptor           `protobuf:\"bytes,8,rep,name=columns\" json:\"columns\"`\n\t// next_column_id is used to ensure that deleted column ids are not reused.\n\tNextColumnID ColumnID                 `protobuf:\"varint,9,opt,name=next_column_id,json=nextColumnId,casttype=ColumnID\" json:\"next_column_id\"`\n\tFamilies     []ColumnFamilyDescriptor `protobuf:\"bytes,22,rep,name=families\" json:\"families\"`\n\t// next_family_id is used to ensure that deleted family ids are not reused.\n\tNextFamilyID FamilyID        `protobuf:\"varint,23,opt,name=next_family_id,json=nextFamilyId,casttype=FamilyID\" json:\"next_family_id\"`\n\tPrimaryIndex IndexDescriptor `protobuf:\"bytes,10,opt,name=primary_index,json=primaryIndex\" json:\"primary_index\"`\n\t// indexes are all the secondary indexes.\n\tIndexes []IndexDescriptor `protobuf:\"bytes,11,rep,name=indexes\" json:\"indexes\"`\n\t// next_index_id is used to ensure that deleted index ids are not reused.\n\tNextIndexID IndexID              `protobuf:\"varint,12,opt,name=next_index_id,json=nextIndexId,casttype=IndexID\" json:\"next_index_id\"`\n\tPrivileges  *PrivilegeDescriptor `protobuf:\"bytes,13,opt,name=privileges\" json:\"privileges,omitempty\"`\n\t// Columns or indexes being added or deleted in a FIFO order.\n\tMutations []DescriptorMutation               `protobuf:\"bytes,14,rep,name=mutations\" json:\"mutations\"`\n\tLease     *TableDescriptor_SchemaChangeLease `protobuf:\"bytes,15,opt,name=lease\" json:\"lease,omitempty\"`\n\t// An id for the next group of mutations to be applied together.\n\tNextMutationID MutationID `protobuf:\"varint,16,opt,name=next_mutation_id,json=nextMutationId,casttype=MutationID\" json:\"next_mutation_id\"`\n\t// format_version declares which sql to key:value mapping is being used to\n\t// represent the data in this table.\n\tFormatVersion FormatVersion                      `protobuf:\"varint,17,opt,name=format_version,json=formatVersion,casttype=FormatVersion\" json:\"format_version\"`\n\tState         TableDescriptor_State              `protobuf:\"varint,19,opt,name=state,enum=cockroach.sql.sqlbase.TableDescriptor_State\" json:\"state\"`\n\tChecks        []*TableDescriptor_CheckConstraint `protobuf:\"bytes,20,rep,name=checks\" json:\"checks,omitempty\"`\n\t// This array is populated if the descriptor was renamed. If the descriptor is\n\t// renamed multiple times before the schema chage is processed, there will be\n\t// one element for each rename.\n\t// When this is detected in a schema change, the records for the old names are\n\t// deleted and this field is cleared.\n\tRenames []TableDescriptor_RenameInfo `protobuf:\"bytes,21,rep,name=renames\" json:\"renames\"`\n\t// The TableDescriptor is used for views in addition to tables. Views\n\t// use mostly the same fields as tables, but need to track the actual\n\t// query from the view definition as well.\n\t//\n\t// Note: The presence of this field is used to determine whether or not\n\t// a TableDescriptor represents a view.\n\tViewQuery string `protobuf:\"bytes,24,opt,name=view_query,json=viewQuery\" json:\"view_query\"`\n}\n```\nA TableDescriptor represents a table or view and is stored in a structured metadata key. The TableDescriptor has a globally-unique ID, while its member {Column,Index}Descriptors have locally-unique IDs.\n\n```go\nfunc GetTableDescFromID(txn *client.Txn, id ID) (*TableDescriptor, error)\n```\nGetTableDescFromID retrieves the table descriptor for the table ID passed in using an existing txn. Teturns an error if the descriptor doesn't exist or if it exists and is not a table.\n\n```go\nfunc GetTableDescriptor(kvDB *client.DB, database string, table string) *TableDescriptor\n```\nGetTableDescriptor retrieves a table descriptor directly from the KV layer.\n\n```go\nfunc (desc *TableDescriptor) AddColumn(col ColumnDescriptor)\n```\nAddColumn adds a column to the table.\n\n```go\nfunc (desc *TableDescriptor) AddColumnMutation(\n\tc ColumnDescriptor, direction DescriptorMutation_Direction,\n)\n```\nAddColumnMutation adds a column mutation to desc.Mutations.\n\n```go\nfunc (desc *TableDescriptor) AddColumnToFamilyMaybeCreate(\n\tcol string, family string, create bool, ifNotExists bool,\n) error\n```\nAddColumnToFamilyMaybeCreate adds the specified column to the specified family. If it doesn't exist and create is true, creates it. If it does exist adds it unless \"strict\" create (\\`true\\` for create but \\`false\\` for ifNotExists) is specified.\n\nAllocateIDs must be called before the TableDesciptor will be valid.\n\n```go\nfunc (desc *TableDescriptor) AddFamily(fam ColumnFamilyDescriptor)\n```\nAddFamily adds a family to the table.\n\n```go\nfunc (desc *TableDescriptor) AddIndex(idx IndexDescriptor, primary bool) error\n```\nAddIndex adds an index to the table.\n\n```go\nfunc (desc *TableDescriptor) AddIndexMutation(\n\tidx IndexDescriptor, direction DescriptorMutation_Direction,\n)\n```\nAddIndexMutation adds an index mutation to desc.Mutations.\n\n```go\nfunc (desc *TableDescriptor) Adding() bool\n```\nAdding returns true if the table is being added.\n\n```go\nfunc (desc *TableDescriptor) AllNonDropIndexes() []IndexDescriptor\n```\nAllNonDropIndexes returns all the indexes, including those being added in the mutations.\n\n```go\nfunc (desc *TableDescriptor) AllocateIDs() error\n```\nAllocateIDs allocates column, family, and index ids for any column, family, or index which has an ID of 0.\n\n```go\nfunc (desc TableDescriptor) CheckUniqueConstraints() error\n```\nCheckUniqueConstraints returns a non-nil error if a descriptor contains two constraints with the same name.\n\n```go\nfunc (desc *TableDescriptor) Deleted() bool\n```\nDeleted returns true if the table is being deleted.\n\n```go\nfunc (*TableDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (desc *TableDescriptor) FinalizeMutation() (MutationID, error)\n```\nFinalizeMutation returns the id that has been used by mutations appended with addMutation() since the last time this function was called. Future mutations will use a new ID.\n\n```go\nfunc (desc *TableDescriptor) FindActiveColumnByID(id ColumnID) (*ColumnDescriptor, error)\n```\nFindActiveColumnByID finds the active column with specified ID.\n\n```go\nfunc (desc *TableDescriptor) FindActiveColumnByName(name parser.Name) (ColumnDescriptor, error)\n```\nFindActiveColumnByName calls FindActiveColumnByNormalizedName on a normalized argument.\n\n```go\nfunc (desc *TableDescriptor) FindActiveColumnByNormalizedName(\n\tnormName string,\n) (ColumnDescriptor, error)\n```\nFindActiveColumnByNormalizedName finds an active column with the specified normalized name.\n\n```go\nfunc (desc *TableDescriptor) FindActiveColumnsByNames(\n\tnames parser.NameList,\n) ([]ColumnDescriptor, error)\n```\nFindActiveColumnsByNames finds all requested columns (in the requested order) or returns an error.\n\n```go\nfunc (desc *TableDescriptor) FindColumnByID(id ColumnID) (*ColumnDescriptor, error)\n```\nFindColumnByID finds the column with specified ID.\n\n```go\nfunc (desc *TableDescriptor) FindColumnByName(name parser.Name) (DescriptorStatus, int, error)\n```\nFindColumnByName calls FindColumnByNormalizedName with a normalized argument.\n\n```go\nfunc (desc *TableDescriptor) FindColumnByNormalizedName(\n\tnormName string,\n) (DescriptorStatus, int, error)\n```\nFindColumnByNormalizedName finds the column with the specified name. It returns DescriptorStatus for the column, and an index into either the columns (status == DescriptorActive) or mutations (status == DescriptorIncomplete).\n\n```go\nfunc (desc *TableDescriptor) FindFamilyByID(id FamilyID) (*ColumnFamilyDescriptor, error)\n```\nFindFamilyByID finds the family with specified ID.\n\n```go\nfunc (desc *TableDescriptor) FindIndexByID(id IndexID) (*IndexDescriptor, error)\n```\nFindIndexByID finds an index (active or inactive) with the specified ID. Must return a pointer to the IndexDescriptor in the TableDescriptor, so that callers can use returned values to modify the TableDesc.\n\n```go\nfunc (desc *TableDescriptor) FindIndexByName(name parser.Name) (DescriptorStatus, int, error)\n```\nFindIndexByName calls FindIndexByNormalizedName on a normalized argument.\n\n```go\nfunc (desc *TableDescriptor) FindIndexByNormalizedName(\n\tnormName string,\n) (DescriptorStatus, int, error)\n```\nFindIndexByNormalizedName finds the index with the specified name. It returns DescriptorStatus for the index, and an index into either the indexes (status == DescriptorActive) or mutations (status == DescriptorIncomplete).\n\n```go\nfunc (m *TableDescriptor) GetChecks() []*TableDescriptor_CheckConstraint\n```\n\n```go\nfunc (m *TableDescriptor) GetColumns() []ColumnDescriptor\n```\n\n```go\nfunc (desc TableDescriptor) GetConstraintInfo(txn *client.Txn) (map[string]ConstraintDetail, error)\n```\nGetConstraintInfo returns a summary of all constraints on the table.\n\n```go\nfunc (m *TableDescriptor) GetFamilies() []ColumnFamilyDescriptor\n```\n\n```go\nfunc (m *TableDescriptor) GetFormatVersion() FormatVersion\n```\n\n```go\nfunc (m *TableDescriptor) GetID() ID\n```\n\n```go\nfunc (m *TableDescriptor) GetIndexes() []IndexDescriptor\n```\n\n```go\nfunc (m *TableDescriptor) GetLease() *TableDescriptor_SchemaChangeLease\n```\n\n```go\nfunc (m *TableDescriptor) GetModificationTime() cockroach_util_hlc.Timestamp\n```\n\n```go\nfunc (m *TableDescriptor) GetMutations() []DescriptorMutation\n```\n\n```go\nfunc (m *TableDescriptor) GetName() string\n```\n\n```go\nfunc (m *TableDescriptor) GetNextColumnID() ColumnID\n```\n\n```go\nfunc (m *TableDescriptor) GetNextFamilyID() FamilyID\n```\n\n```go\nfunc (m *TableDescriptor) GetNextIndexID() IndexID\n```\n\n```go\nfunc (m *TableDescriptor) GetNextMutationID() MutationID\n```\n\n```go\nfunc (m *TableDescriptor) GetParentID() ID\n```\n\n```go\nfunc (m *TableDescriptor) GetPrimaryIndex() IndexDescriptor\n```\n\n```go\nfunc (m *TableDescriptor) GetPrivileges() *PrivilegeDescriptor\n```\n\n```go\nfunc (m *TableDescriptor) GetRenames() []TableDescriptor_RenameInfo\n```\n\n```go\nfunc (m *TableDescriptor) GetState() TableDescriptor_State\n```\n\n```go\nfunc (m *TableDescriptor) GetUpVersion() bool\n```\n\n```go\nfunc (m *TableDescriptor) GetVersion() DescriptorVersion\n```\n\n```go\nfunc (m *TableDescriptor) GetViewQuery() string\n```\n\n```go\nfunc (desc *TableDescriptor) IsEmpty() bool\n```\nIsEmpty checks if the descriptor is uninitialized.\n\n```go\nfunc (desc *TableDescriptor) IsInterleaved() bool\n```\nIsInterleaved returns true if any part of this this table is interleaved with another table's data.\n\n```go\nfunc (desc *TableDescriptor) IsPhysicalTable() bool\n```\nIsPhysicalTable returns true if the TableDescriptor actually describes a physical Table that needs to be stored in the kv layer, as opposed to a different resource like a view or a virtual table. Physical tables have primary keys, column families, and indexes (unlike virtual tables).\n\n```go\nfunc (desc *TableDescriptor) IsTable() bool\n```\nIsTable returns true if the TableDescriptor actually describes a Table resource, as opposed to a different resource (like a View).\n\n```go\nfunc (desc *TableDescriptor) IsView() bool\n```\nIsView returns true if the TableDescriptor actually describes a View resource rather than a Table.\n\n```go\nfunc (desc *TableDescriptor) IsVirtualTable() bool\n```\nIsVirtualTable returns true if the TableDescriptor describes a virtual Table (like the information\\_schema tables) and thus doesn't need to be physically stored.\n\n```go\nfunc (desc *TableDescriptor) MakeMutationComplete(m DescriptorMutation)\n```\nMakeMutationComplete updates the descriptor upon completion of a mutation.\n\n```go\nfunc (m *TableDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *TableDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (desc *TableDescriptor) MaybeUpgradeFormatVersion() bool\n```\nMaybeUpgradeFormatVersion transforms the TableDescriptor to the latest FormatVersion (if it's not already there) and returns true if any changes were made.\n\n```go\nfunc (*TableDescriptor) ProtoMessage()\n```\n\n```go\nfunc (desc *TableDescriptor) RemoveColumnFromFamily(colID ColumnID)\n```\nRemoveColumnFromFamily removes a colID from the family it's assigned to.\n\n```go\nfunc (desc *TableDescriptor) RenameColumnNormalized(colID ColumnID, newColName string)\n```\nRenameColumnNormalized updates all references to a column name in indexes and families.\n\n```go\nfunc (desc *TableDescriptor) Renamed() bool\n```\nRenamed returns true if the table is being renamed.\n\n```go\nfunc (m *TableDescriptor) Reset()\n```\n\n```go\nfunc (desc *TableDescriptor) SetID(id ID)\n```\nSetID implements the DescriptorProto interface.\n\n```go\nfunc (desc *TableDescriptor) SetName(name string)\n```\nSetName implements the DescriptorProto interface.\n\n```go\nfunc (desc *TableDescriptor) SetUpVersion() error\n```\nSetUpVersion sets the up\\_version marker on the table descriptor (see the proto\n\n```go\nfunc (m *TableDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *TableDescriptor) String() string\n```\n\n```go\nfunc (desc *TableDescriptor) TypeName() string\n```\nTypeName returns the plain type of this descriptor.\n\n```go\nfunc (m *TableDescriptor) Unmarshal(data []byte) error\n```\n\n```go\nfunc (desc *TableDescriptor) Validate(txn *client.Txn) error\n```\nValidate validates that the table descriptor is well formed. Checks include both single table and cross table invariants.\n\n```go\nfunc (desc *TableDescriptor) ValidateTable() error\n```\nValidateTable validates that the table descriptor is well formed. Checks include validating the table, column and index names, verifying that column names and index names are unique and verifying that column IDs and index IDs are consistent. Use Validate to validate that cross-table references are correct.\n\n```go\nfunc (desc *TableDescriptor) VisibleColumns() []ColumnDescriptor\n```\nVisibleColumns returns all non hidden columns.\n\n```go\ntype TableDescriptor_CheckConstraint struct {\n\tExpr     string             `protobuf:\"bytes,1,opt,name=expr\" json:\"expr\"`\n\tName     string             `protobuf:\"bytes,2,opt,name=name\" json:\"name\"`\n\tValidity ConstraintValidity `protobuf:\"varint,3,opt,name=validity,enum=cockroach.sql.sqlbase.ConstraintValidity\" json:\"validity\"`\n}\n```\n\n```go\nfunc (*TableDescriptor_CheckConstraint) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *TableDescriptor_CheckConstraint) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *TableDescriptor_CheckConstraint) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*TableDescriptor_CheckConstraint) ProtoMessage()\n```\n\n```go\nfunc (m *TableDescriptor_CheckConstraint) Reset()\n```\n\n```go\nfunc (m *TableDescriptor_CheckConstraint) Size() (n int)\n```\n\n```go\nfunc (m *TableDescriptor_CheckConstraint) String() string\n```\n\n```go\nfunc (m *TableDescriptor_CheckConstraint) Unmarshal(data []byte) error\n```\n\n```go\ntype TableDescriptor_RenameInfo struct {\n\t// The database that the table belonged to before the rename (tables can be\n\t// renamed from one db to another).\n\tOldParentID ID     `protobuf:\"varint,1,opt,name=old_parent_id,json=oldParentId,casttype=ID\" json:\"old_parent_id\"`\n\tOldName     string `protobuf:\"bytes,2,opt,name=old_name,json=oldName\" json:\"old_name\"`\n}\n```\n\n```go\nfunc (*TableDescriptor_RenameInfo) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *TableDescriptor_RenameInfo) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *TableDescriptor_RenameInfo) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*TableDescriptor_RenameInfo) ProtoMessage()\n```\n\n```go\nfunc (m *TableDescriptor_RenameInfo) Reset()\n```\n\n```go\nfunc (m *TableDescriptor_RenameInfo) Size() (n int)\n```\n\n```go\nfunc (m *TableDescriptor_RenameInfo) String() string\n```\n\n```go\nfunc (m *TableDescriptor_RenameInfo) Unmarshal(data []byte) error\n```\n\n```go\ntype TableDescriptor_SchemaChangeLease struct {\n\tNodeID github_com_cockroachdb_cockroach_roachpb.NodeID `protobuf:\"varint,1,opt,name=node_id,json=nodeId,casttype=github.com/cockroachdb/cockroach/roachpb.NodeID\" json:\"node_id\"`\n\t// Nanoseconds since the Unix epoch.\n\tExpirationTime int64 `protobuf:\"varint,2,opt,name=expiration_time,json=expirationTime\" json:\"expiration_time\"`\n}\n```\nThe schema update lease. A single goroutine across a cockroach cluster can own it, and will execute pending schema changes for this table. Since the execution of a pending schema change is through transactions, it is legal for more than one goroutine to attempt to execute it. This lease reduces write contention on the schema change.\n\n```go\nfunc (*TableDescriptor_SchemaChangeLease) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *TableDescriptor_SchemaChangeLease) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *TableDescriptor_SchemaChangeLease) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*TableDescriptor_SchemaChangeLease) ProtoMessage()\n```\n\n```go\nfunc (m *TableDescriptor_SchemaChangeLease) Reset()\n```\n\n```go\nfunc (m *TableDescriptor_SchemaChangeLease) Size() (n int)\n```\n\n```go\nfunc (m *TableDescriptor_SchemaChangeLease) String() string\n```\n\n```go\nfunc (m *TableDescriptor_SchemaChangeLease) Unmarshal(data []byte) error\n```\n\n```go\ntype TableDescriptor_State int32\n```\nState is set if this TableDescriptor is in the process of being added or deleted. A non-public table descriptor cannot be leased. A schema changer observing DROP set will truncate the table and delete the descriptor. It is illegal to transition DROP to any other state.\n\n```go\nconst (\n\t// Not used.\n\tTableDescriptor_PUBLIC TableDescriptor_State = 0\n\t// Descriptor is being added.\n\tTableDescriptor_ADD TableDescriptor_State = 1\n\t// Descriptor is being dropped.\n\tTableDescriptor_DROP TableDescriptor_State = 2\n)\n```\n\n```go\nfunc (x TableDescriptor_State) Enum() *TableDescriptor_State\n```\n\n```go\nfunc (TableDescriptor_State) EnumDescriptor() ([]byte, []int)\n```\n\n```go\nfunc (x TableDescriptor_State) String() string\n```\n\n```go\nfunc (x *TableDescriptor_State) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype UserPrivilegeString struct {\n\tUser       string\n\tPrivileges []string\n}\n```\nUserPrivilegeString is a pair of strings describing the privileges for a given user.\n\n```go\nfunc (u UserPrivilegeString) PrivilegeString() string\n```\nPrivilegeString returns a string of comma-separted privilege names.\n\n```go\ntype UserPrivileges struct {\n\tUser string `protobuf:\"bytes,1,opt,name=user\" json:\"user\"`\n\t// privileges is a bitfield of 1\u003c\u003cPrivilege values.\n\tPrivileges uint32 `protobuf:\"varint,2,opt,name=privileges\" json:\"privileges\"`\n}\n```\nUserPrivileges describes the list of privileges available for a given user.\n\n```go\nfunc (*UserPrivileges) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *UserPrivileges) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *UserPrivileges) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*UserPrivileges) ProtoMessage()\n```\n\n```go\nfunc (m *UserPrivileges) Reset()\n```\n\n```go\nfunc (m *UserPrivileges) Size() (n int)\n```\n\n```go\nfunc (m *UserPrivileges) String() string\n```\n\n```go\nfunc (m *UserPrivileges) Unmarshal(data []byte) error\n```\n\n","path":"github.com/aishraj/cockroach/sql/sqlbase","name":"sqlbase","synopsis":"Package sqlbase is a generated protocol buffer package.","isRedistributable":true}
