From f5762cbc27d810d392ba46bda42f1ff53ce321e6 Mon Sep 17 00:00:00 2001 From: Faizan Qazi Date: Thu, 10 Jun 2021 17:01:05 -0400 Subject: [PATCH] sql: added support for create index inside new schema changer Fixes: #67264 Previously, create index was not supported inside the new shcema changer. This was inadequate because, to help support transaction schema changes in the future we need all schema changes inside the new schema changer. To address this, this patch adds CREATE INDEX inside the new schema changer. Release note: None --- .../testdata/logic_test/new_schema_changer | 13 + pkg/ccl/partitionccl/BUILD.bazel | 1 + pkg/ccl/partitionccl/partition.go | 2 + .../protectedts/ptstorage/BUILD.bazel | 1 + .../protectedts/ptstorage/storage_test.go | 7 + pkg/sql/catalog/tabledesc/structured.go | 8 +- pkg/sql/create_table.go | 50 +- .../testdata/logic_test/new_schema_changer | 177 + pkg/sql/schemachanger/scbuild/BUILD.bazel | 2 + pkg/sql/schemachanger/scbuild/builder.go | 21 + pkg/sql/schemachanger/scbuild/dependencies.go | 17 + pkg/sql/schemachanger/scbuild/index.go | 405 ++ pkg/sql/schemachanger/scbuild/table.go | 120 +- .../scbuild/testdata/create_index | 144 + pkg/sql/schemachanger/scdeps/build_deps.go | 27 + pkg/sql/schemachanger/scdeps/exec_deps.go | 62 + .../scexec/scmutationexec/BUILD.bazel | 2 + .../scexec/scmutationexec/scmutationexec.go | 176 +- pkg/sql/schemachanger/scop/BUILD.bazel | 1 + pkg/sql/schemachanger/scop/mutation.go | 46 +- .../scop/mutation_visitor_generated.go | 12 + pkg/sql/schemachanger/scop/validation.go | 5 +- .../schemachanger/scpb/elements_generated.go | 3 +- pkg/sql/schemachanger/scpb/scpb.pb.go | 5335 ++++++++++++----- pkg/sql/schemachanger/scpb/scpb.proto | 60 +- .../schemachanger/scplan/deprules/helpers.go | 15 - .../schemachanger/scplan/deprules/rules.go | 82 +- .../scplan/opgen/opgen_partitioning.go | 35 + .../scplan/opgen/opgen_primary_index.go | 49 +- .../scplan/opgen/opgen_secondary_index.go | 80 + pkg/sql/schemachanger/scplan/plan_test.go | 4 +- .../scplan/testdata/create_index | 125 + pkg/sql/schemachanger/screl/attr.go | 12 +- 33 files changed, 5483 insertions(+), 1616 deletions(-) create mode 100644 pkg/ccl/logictestccl/testdata/logic_test/new_schema_changer create mode 100644 pkg/sql/schemachanger/scbuild/index.go create mode 100644 pkg/sql/schemachanger/scbuild/testdata/create_index create mode 100644 pkg/sql/schemachanger/scplan/opgen/opgen_partitioning.go create mode 100644 pkg/sql/schemachanger/scplan/testdata/create_index diff --git a/pkg/ccl/logictestccl/testdata/logic_test/new_schema_changer b/pkg/ccl/logictestccl/testdata/logic_test/new_schema_changer new file mode 100644 index 000000000000..a22364def64d --- /dev/null +++ b/pkg/ccl/logictestccl/testdata/logic_test/new_schema_changer @@ -0,0 +1,13 @@ +statement ok +SET experimental_use_new_schema_changer = 'on' + +subtest create_index + +statement ok +CREATE TABLE defaultdb.t1 (id INT PRIMARY KEY, name varchar(256), money int) + +statement ok +CREATE INDEX id1 on defaultdb.t1(id, name) storing (money) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1) + ); + diff --git a/pkg/ccl/partitionccl/BUILD.bazel b/pkg/ccl/partitionccl/BUILD.bazel index e69c6e278bfb..d545ffeb1d93 100644 --- a/pkg/ccl/partitionccl/BUILD.bazel +++ b/pkg/ccl/partitionccl/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//pkg/sql/pgwire/pgcode", "//pkg/sql/pgwire/pgerror", "//pkg/sql/rowenc", + "//pkg/sql/schemachanger/scbuild", "//pkg/sql/sem/tree", "//pkg/sql/types", "//pkg/util/encoding", diff --git a/pkg/ccl/partitionccl/partition.go b/pkg/ccl/partitionccl/partition.go index 5b12f8a2ed7b..5c53b256e9ff 100644 --- a/pkg/ccl/partitionccl/partition.go +++ b/pkg/ccl/partitionccl/partition.go @@ -23,6 +23,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror" "github.com/cockroachdb/cockroach/pkg/sql/rowenc" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scbuild" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/types" "github.com/cockroachdb/cockroach/pkg/util/encoding" @@ -611,4 +612,5 @@ func selectPartitionExprsByName( func init() { sql.CreatePartitioningCCL = createPartitioning + scbuild.CreatePartitioningCCL = createPartitioning } diff --git a/pkg/kv/kvserver/protectedts/ptstorage/BUILD.bazel b/pkg/kv/kvserver/protectedts/ptstorage/BUILD.bazel index b9d9bd3833d0..e26d9d972a86 100644 --- a/pkg/kv/kvserver/protectedts/ptstorage/BUILD.bazel +++ b/pkg/kv/kvserver/protectedts/ptstorage/BUILD.bazel @@ -49,6 +49,7 @@ go_test( "//pkg/security/securitytest", "//pkg/server", "//pkg/sql", + "//pkg/sql/catalog", "//pkg/sql/catalog/colinfo", "//pkg/sql/sem/tree", "//pkg/sql/sessiondata", diff --git a/pkg/kv/kvserver/protectedts/ptstorage/storage_test.go b/pkg/kv/kvserver/protectedts/ptstorage/storage_test.go index 9a0452d52aa4..f3a658ddf1a7 100644 --- a/pkg/kv/kvserver/protectedts/ptstorage/storage_test.go +++ b/pkg/kv/kvserver/protectedts/ptstorage/storage_test.go @@ -30,6 +30,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/security" "github.com/cockroachdb/cockroach/pkg/sql" + "github.com/cockroachdb/cockroach/pkg/sql/catalog" "github.com/cockroachdb/cockroach/pkg/sql/catalog/colinfo" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" @@ -801,3 +802,9 @@ func (ie *wrappedInternalExecutor) setErrFunc(f func(statement string) error) { defer ie.mu.Unlock() ie.mu.errFunc = f } + +func (ie *wrappedInternalExecutor) WithSyntheticDescriptors( + descs []catalog.Descriptor, run func() error, +) error { + panic("not implemented") +} diff --git a/pkg/sql/catalog/tabledesc/structured.go b/pkg/sql/catalog/tabledesc/structured.go index a66c9cc4c031..76880b634a40 100644 --- a/pkg/sql/catalog/tabledesc/structured.go +++ b/pkg/sql/catalog/tabledesc/structured.go @@ -137,7 +137,7 @@ func (desc *wrapper) KeysPerRow(indexID descpb.IndexID) (int, error) { return len(desc.Families), nil } -// buildIndexName returns an index name that is not equal to any +// BuildIndexName returns an index name that is not equal to any // of tableDesc's indexes, roughly following Postgres's conventions for naming // anonymous indexes. For example: // @@ -150,9 +150,7 @@ func (desc *wrapper) KeysPerRow(indexID descpb.IndexID) (int, error) { // CREATE INDEX ON t ((a + b), c, lower(d)) // => t_expr_c_expr1_idx // -func buildIndexName(tableDesc *Mutable, index catalog.Index) (string, error) { - idx := index.IndexDesc() - +func BuildIndexName(tableDesc *Mutable, idx *descpb.IndexDescriptor) (string, error) { // An index name has a segment for the table name, each key column, and a // final word (either "idx" or "key"). segments := make([]string, 0, len(idx.KeyColumnNames)+2) @@ -680,7 +678,7 @@ func (desc *Mutable) allocateIndexIDs(columnNames map[string]descpb.ColumnID) er // Assign names to unnamed indexes. err := catalog.ForEachDeletableNonPrimaryIndex(desc, func(idx catalog.Index) error { if len(idx.GetName()) == 0 { - name, err := buildIndexName(desc, idx) + name, err := BuildIndexName(desc, idx.IndexDesc()) if err != nil { return err } diff --git a/pkg/sql/create_table.go b/pkg/sql/create_table.go index 90d8f741551e..0808d8ab3e43 100644 --- a/pkg/sql/create_table.go +++ b/pkg/sql/create_table.go @@ -40,6 +40,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgnotice" "github.com/cockroachdb/cockroach/pkg/sql/row" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scbuild" "github.com/cockroachdb/cockroach/pkg/sql/sem/builtins" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" @@ -2702,60 +2703,13 @@ func makeShardColumnDesc( } col.Name = tabledesc.GetShardColumnName(colNames, int32(buckets)) if useDatumsToBytes { - col.ComputeExpr = makeHashShardComputeExpr(colNames, buckets) + col.ComputeExpr = scbuild.MakeHashShardComputeExpr(colNames, buckets) } else { col.ComputeExpr = makeDeprecatedHashShardComputeExpr(colNames, buckets) } - return col, nil } -// makeDeprecatedHashShardComputeExpr creates the serialized computed expression for a hash shard -// column based on the column names and the number of buckets. The expression will be -// of the form: -// -// mod(fnv32(crdb_internal.datums_to_bytes(...)),buckets) -// -func makeHashShardComputeExpr(colNames []string, buckets int) *string { - unresolvedFunc := func(funcName string) tree.ResolvableFunctionReference { - return tree.ResolvableFunctionReference{ - FunctionReference: &tree.UnresolvedName{ - NumParts: 1, - Parts: tree.NameParts{funcName}, - }, - } - } - columnItems := func() tree.Exprs { - exprs := make(tree.Exprs, len(colNames)) - for i := range exprs { - exprs[i] = &tree.ColumnItem{ColumnName: tree.Name(colNames[i])} - } - return exprs - } - hashedColumnsExpr := func() tree.Expr { - return &tree.FuncExpr{ - Func: unresolvedFunc("fnv32"), - Exprs: tree.Exprs{ - &tree.FuncExpr{ - Func: unresolvedFunc("crdb_internal.datums_to_bytes"), - Exprs: columnItems(), - }, - }, - } - } - modBuckets := func(expr tree.Expr) tree.Expr { - return &tree.FuncExpr{ - Func: unresolvedFunc("mod"), - Exprs: tree.Exprs{ - expr, - tree.NewDInt(tree.DInt(buckets)), - }, - } - } - res := tree.Serialize(modBuckets(hashedColumnsExpr())) - return &res -} - // makeDeprecatedHashShardComputeExpr creates the serialized computed expression for a hash shard // column based on the column names and the number of buckets. The expression will be // of the form: diff --git a/pkg/sql/logictest/testdata/logic_test/new_schema_changer b/pkg/sql/logictest/testdata/logic_test/new_schema_changer index 4706e29f414a..7d2116e36b2f 100644 --- a/pkg/sql/logictest/testdata/logic_test/new_schema_changer +++ b/pkg/sql/logictest/testdata/logic_test/new_schema_changer @@ -679,3 +679,180 @@ CREATE TABLE public.trewrite ( CONSTRAINT new_primary_key PRIMARY KEY (k ASC), FAMILY fam_0_k_ts (k, ts, c) ) + +subtest create-index +statement ok +CREATE TABLE tIndex ( + a INT PRIMARY KEY, + b INT, + FAMILY (a), + FAMILY (b) +) + +statement ok +INSERT INTO tIndex VALUES (1,1) + +user root + +statement ok +CREATE INDEX foo ON tIndex (b) + +statement error relation \"foo\" already exists +CREATE INDEX foo ON tIndex (a) + +statement error column "c" does not exist +CREATE INDEX bar ON tIndex (c) + +statement error index \"bar\" contains duplicate column \"b\" +CREATE INDEX bar ON tIndex (b, b); + +statement error pgcode 0A000 only simple columns are supported as index elements +CREATE INDEX bar ON tIndex ((a+b)) + +statement error pgcode 0A000 only simple columns are supported as index elements +CREATE INDEX bar ON tIndex (abs(b)) + +statement error pgcode 0A000 only simple columns are supported as index elements +CREATE UNIQUE INDEX bar ON tIndex (abs(b)) + +statement error pgcode 0A000 only simple columns are supported as index elements +CREATE INVERTED INDEX bar ON tIndex ((ARRAY[a,b])) + +statement error pgcode 0A000 only simple columns are supported as index elements +CREATE TABLE tIndx2 (a INT PRIMARY KEY, b INT, INDEX ((a+b))) + +statement error pgcode 0A000 only simple columns are supported as index elements +CREATE TABLE tIndx2 (a INT PRIMARY KEY, b INT, INVERTED INDEX ((ARRAY[a,b]))) + +query TTBITTBB colnames +SHOW INDEXES FROM tIndex +---- +table_name index_name non_unique seq_in_index column_name direction storing implicit +tindex foo true 1 b ASC false false +tindex foo true 2 a ASC false true +tindex primary false 1 a ASC false false +tindex primary false 2 b N/A true false + +statement ok +INSERT INTO tIndex VALUES (2,1) + +# FIXME: Disabled until rollback is supported +#statement error pgcode 23505 violates unique constraint "bar" +#CREATE UNIQUE INDEX bar ON tIndex (b) + +query TTBITTBB colnames +SHOW INDEXES FROM tIndex +---- +table_name index_name non_unique seq_in_index column_name direction storing implicit +tindex foo true 1 b ASC false false +tindex foo true 2 a ASC false true +tindex primary false 1 a ASC false false +tindex primary false 2 b N/A true false + +# test for DESC index + +statement ok +DROP TABLE tIndex + +statement ok +CREATE TABLE tIndx ( + a INT PRIMARY KEY, + b INT, + c INT +) + +statement ok +INSERT INTO tIndx VALUES (1,1,1), (2,2,2) + +statement ok +CREATE INDEX b_desc ON tIndx (b DESC) + +statement ok +CREATE INDEX b_asc ON tIndx (b ASC, c DESC) + +query TTBITTBB colnames +SHOW INDEXES FROM tIndx +---- +table_name index_name non_unique seq_in_index column_name direction storing implicit +tindx b_asc true 1 b ASC false false +tindx b_asc true 2 c DESC false false +tindx b_asc true 3 a ASC false true +tindx b_desc true 1 b DESC false false +tindx b_desc true 2 a ASC false true +tindx primary false 1 a ASC false false +tindx primary false 2 b N/A true false +tindx primary false 3 c N/A true false + +statement error pgcode 42P01 relation "foo" does not exist +CREATE INDEX fail ON foo (b DESC) + +statement ok +CREATE VIEW vIndx AS SELECT a,b FROM tIndx + +statement error pgcode 42809 "vindx" is not a table or materialized view +CREATE INDEX failview ON vIndx (b DESC) + +statement ok +CREATE TABLE privs (a INT PRIMARY KEY, b INT) + +user testuser + +statement error user testuser does not have CREATE privilege on relation privs +CREATE INDEX foo ON privs (b) + +user root + +query TTBITTBB colnames +SHOW INDEXES FROM privs +---- +table_name index_name non_unique seq_in_index column_name direction storing implicit +privs primary false 1 a ASC false false +privs primary false 2 b N/A true false + +statement ok +GRANT CREATE ON privs TO testuser + +user testuser + +statement ok +CREATE INDEX foo ON privs (b) + +query TTBITTBB colnames +SHOW INDEXES FROM privs +---- +table_name index_name non_unique seq_in_index column_name direction storing implicit +privs foo true 1 b ASC false false +privs foo true 2 a ASC false true +privs primary false 1 a ASC false false +privs primary false 2 b N/A true false + + +user root + +statement ok +SET experimental_enable_hash_sharded_indexes = true; +CREATE TABLE telemetry ( + x INT PRIMARY KEY, + y INT, + z JSONB +) + + +# Test that creating an index on a column which is currently being dropped +# causes an error. +subtest create_index_on_dropping_column + +statement ok +CREATE TABLE create_idx_drop_column (c0 INT PRIMARY KEY, c1 INT); + +statement ok +begin; ALTER TABLE create_idx_drop_column DROP COLUMN c1; + +statement error column "c1" does not exist +CREATE INDEX idx_create_idx_drop_column ON create_idx_drop_column (c1); + +statement ok +ROLLBACK; + +statement ok +DROP TABLE create_idx_drop_column; diff --git a/pkg/sql/schemachanger/scbuild/BUILD.bazel b/pkg/sql/schemachanger/scbuild/BUILD.bazel index 9c787bf8bb8c..052b0e44e32e 100644 --- a/pkg/sql/schemachanger/scbuild/BUILD.bazel +++ b/pkg/sql/schemachanger/scbuild/BUILD.bazel @@ -6,6 +6,7 @@ go_library( "builder.go", "database.go", "dependencies.go", + "index.go", "relation_common.go", "schema.go", "sequence.go", @@ -17,6 +18,7 @@ go_library( visibility = ["//visibility:public"], deps = [ "//pkg/keys", + "//pkg/clusterversion", "//pkg/settings/cluster", "//pkg/sql/catalog", "//pkg/sql/catalog/descpb", diff --git a/pkg/sql/schemachanger/scbuild/builder.go b/pkg/sql/schemachanger/scbuild/builder.go index b31d69b706e9..82d3e182ff22 100644 --- a/pkg/sql/schemachanger/scbuild/builder.go +++ b/pkg/sql/schemachanger/scbuild/builder.go @@ -134,12 +134,33 @@ func (b *buildContext) build(ctx context.Context, n tree.Statement) (output scpb b.dropDatabase(ctx, n) case *tree.AlterTable: b.alterTable(ctx, n) + case *tree.CreateIndex: + b.createIndex(ctx, n) default: return nil, ¬ImplementedError{n: n} } return b.output, nil } +// checkIfNodeExists checks if an existing node is already there, +// in any direction. +func (b *buildContext) checkIfNewColumnExistsByName(tableID descpb.ID, name tree.Name) bool { + // Check if any existing node matches the new node we are + // trying to add. + for _, node := range b.output { + if node.Status != scpb.Status_ABSENT { + continue + } + column, ok := node.Element().(*scpb.Column) + if ok && + column.TableID == tableID && + column.Column.Name == string(name) { + return true + } + } + return false +} + // checkIfNodeExists checks if an existing node is already there, // in any direction. func (b *buildContext) checkIfNodeExists( diff --git a/pkg/sql/schemachanger/scbuild/dependencies.go b/pkg/sql/schemachanger/scbuild/dependencies.go index e66c96a417dc..b572ba18b767 100644 --- a/pkg/sql/schemachanger/scbuild/dependencies.go +++ b/pkg/sql/schemachanger/scbuild/dependencies.go @@ -21,12 +21,14 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/privilege" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" + "github.com/cockroachdb/cockroach/pkg/sql/types" ) // Dependencies contains all the dependencies required by the builder. type Dependencies interface { CatalogReader() CatalogReader AuthorizationAccessor() AuthorizationAccessor + DescUtils() DescUtils // Codec returns the current session data, as in execCfg. // So far this is used only to build a tree.EvalContext. @@ -42,6 +44,21 @@ type Dependencies interface { Statements() []string } +// DescUtils utility functions for helping build different parts +// of descriptors. +type DescUtils interface { + EvalShardBucketCount(ctx context.Context, shardBuckets tree.Expr) (int32, error) + DequalifyAndValidateExpr( + ctx context.Context, + desc catalog.TableDescriptor, + expr tree.Expr, + typ *types.T, + context string, + maxVolatility tree.Volatility, + tn *tree.TableName, + ) (string, *types.T, catalog.TableColSet, error) +} + // CatalogReader should implement descriptor resolution, namespace lookups, and // all such catalog read operations for the builder. The following contract must // apply: diff --git a/pkg/sql/schemachanger/scbuild/index.go b/pkg/sql/schemachanger/scbuild/index.go new file mode 100644 index 000000000000..389921b82b52 --- /dev/null +++ b/pkg/sql/schemachanger/scbuild/index.go @@ -0,0 +1,405 @@ +// Copyright 2021 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package scbuild + +import ( + "context" + + "github.com/cockroachdb/cockroach/pkg/clusterversion" + "github.com/cockroachdb/cockroach/pkg/settings/cluster" + "github.com/cockroachdb/cockroach/pkg/sql/catalog" + "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" + "github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc" + "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode" + "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" + "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" + "github.com/cockroachdb/cockroach/pkg/sql/sqlerrors" + "github.com/cockroachdb/cockroach/pkg/sql/types" + "github.com/cockroachdb/errors" +) + +// CreatePartitioningCCL is the public hook point for the CCL-licensed +// partitioning creation code. +var CreatePartitioningCCL = func( + ctx context.Context, + st *cluster.Settings, + evalCtx *tree.EvalContext, + tableDesc *tabledesc.Mutable, + indexDesc descpb.IndexDescriptor, + partBy *tree.PartitionBy, + allowedNewColumnNames []tree.Name, + allowImplicitPartitioning bool, +) (newImplicitCols []catalog.Column, newPartitioning descpb.PartitioningDescriptor, err error) { + return nil, descpb.PartitioningDescriptor{}, sqlerrors.NewCCLRequiredError(errors.New( + "creating or manipulating partitions requires a CCL binary")) +} + +// makeShardColumnDesc returns a new column descriptor for a hidden computed shard column +// based on all the `colNames`. +func makeShardColumnDesc(colNames []string, buckets int) (*descpb.ColumnDescriptor, error) { + col := &descpb.ColumnDescriptor{ + Hidden: true, + Nullable: false, + Type: types.Int4, + } + col.Name = tabledesc.GetShardColumnName(colNames, int32(buckets)) + col.ComputeExpr = MakeHashShardComputeExpr(colNames, buckets) + return col, nil +} + +// MakeHashShardComputeExpr creates the serialized computed expression for a hash shard +// column based on the column names and the number of buckets. The expression will be +// of the form: +// +// mod(fnv32(crdb_internal.datums_to_bytes(...)),buckets) +// +func MakeHashShardComputeExpr(colNames []string, buckets int) *string { + unresolvedFunc := func(funcName string) tree.ResolvableFunctionReference { + return tree.ResolvableFunctionReference{ + FunctionReference: &tree.UnresolvedName{ + NumParts: 1, + Parts: tree.NameParts{funcName}, + }, + } + } + columnItems := func() tree.Exprs { + exprs := make(tree.Exprs, len(colNames)) + for i := range exprs { + exprs[i] = &tree.ColumnItem{ColumnName: tree.Name(colNames[i])} + } + return exprs + } + hashedColumnsExpr := func() tree.Expr { + return &tree.FuncExpr{ + Func: unresolvedFunc("fnv32"), + Exprs: tree.Exprs{ + &tree.FuncExpr{ + Func: unresolvedFunc("crdb_internal.datums_to_bytes"), + Exprs: columnItems(), + }, + }, + } + } + modBuckets := func(expr tree.Expr) tree.Expr { + return &tree.FuncExpr{ + Func: unresolvedFunc("mod"), + Exprs: tree.Exprs{ + expr, + tree.NewDInt(tree.DInt(buckets)), + }, + } + } + res := tree.Serialize(modBuckets(hashedColumnsExpr())) + return &res +} + +// maybeCreateAndAddShardCol adds a new hidden computed shard column (or its mutation) to +// `desc`, if one doesn't already exist for the given index column set and number of shard +// buckets. +func (b *buildContext) maybeCreateAndAddShardCol( + shardBuckets int, desc catalog.TableDescriptor, colNames []string, isNewTable bool, +) (created bool, err error) { + shardColDesc, err := makeShardColumnDesc(colNames, shardBuckets) + if err != nil { + return false, err + } + existingShardCol, err := desc.FindColumnWithName(tree.Name(shardColDesc.Name)) + if err == nil && !existingShardCol.Dropped() { + // TODO(ajwerner): In what ways is existingShardCol allowed to differ from + // the newly made shardCol? Should there be some validation of + // existingShardCol? + if !existingShardCol.IsHidden() { + // The user managed to reverse-engineer our crazy shard column name, so + // we'll return an error here rather than try to be tricky. + return false, pgerror.Newf(pgcode.DuplicateColumn, + "column %s already specified; can't be used for sharding", shardColDesc.Name) + } + return false, nil + } + columnIsUndefined := sqlerrors.IsUndefinedColumnError(err) + if err != nil && !columnIsUndefined { + return false, err + } + if columnIsUndefined || existingShardCol.Dropped() { + if isNewTable { + panic(false) + //desc.AddColumn(shardColDesc) + } else { + shardColDesc.ID = b.nextColumnID(desc) + column := &scpb.Column{ + Column: *shardColDesc, + TableID: desc.GetID(), + FamilyID: desc.GetFamilies()[0].ID, + FamilyName: desc.GetFamilies()[0].Name, + } + b.addNode(scpb.Target_ADD, column) + } + if !shardColDesc.Virtual { + // Replace the primary index + oldPrimaryIndex := primaryIndexElemFromDescriptor(desc.GetPrimaryIndex().IndexDesc(), desc) + newPrimaryIndex := primaryIndexElemFromDescriptor(desc.GetPrimaryIndex().IndexDesc(), desc) + newPrimaryIndex.IndexId = b.nextIndexID(desc) + newPrimaryIndex.IndexName = tabledesc.GenerateUniqueName( + "new_primary_key", + func(name string) bool { + // TODO (lucy): Also check the new indexes specified in the targets. + _, err := desc.FindIndexWithName(name) + return err == nil + }, + ) + newPrimaryIndex.StoringColumnIDs = append(newPrimaryIndex.StoringColumnIDs, shardColDesc.ID) + b.addNode(scpb.Target_DROP, oldPrimaryIndex) + b.addNode(scpb.Target_ADD, newPrimaryIndex) + } + created = true + } + return created, nil +} + +func (b *buildContext) createIndex(ctx context.Context, n *tree.CreateIndex) { + // Look up the table first. + _, table := b.CatalogReader().MayResolveTable(ctx, *n.Table.ToUnresolvedObjectName()) + if table == nil { + panic(sqlerrors.NewUndefinedRelationError(n.Table.ToUnresolvedObjectName())) + } + // Detect if the index already exists. + foundIndex, err := table.FindIndexWithName(n.Name.String()) + if err == nil { + if foundIndex.Dropped() { + panic(pgerror.Newf(pgcode.ObjectNotInPrerequisiteState, + "index %q being dropped, try again later", n.Name.String())) + } + if n.IfNotExists { + return + } + panic(sqlerrors.NewRelationAlreadyExistsError(n.Name.String())) + } + + if table.IsView() && !table.MaterializedView() { + panic(pgerror.Newf(pgcode.WrongObjectType, "%q is not a table or materialized view", &n.Table)) + } + + if table.MaterializedView() { + if n.Interleave != nil { + panic(pgerror.New(pgcode.InvalidObjectDefinition, + "cannot create interleaved index on materialized view")) + } + if n.Sharded != nil { + panic(pgerror.New(pgcode.InvalidObjectDefinition, + "cannot create hash sharded index on materialized view")) + } + } + + if n.PartitionByIndex != nil && table.GetLocalityConfig() != nil { + panic(pgerror.New( + pgcode.FeatureNotSupported, + "cannot define PARTITION BY on a new INDEX in a multi-region database", + )) + } + + // Setup an secondary index node. + secondaryIndex := &scpb.SecondaryIndex{TableID: table.GetID(), + IndexName: n.Name.Normalize(), + Unique: n.Unique, + KeyColumnIDs: make([]descpb.ColumnID, 0, len(n.Columns)), + StoringColumnIDs: make([]descpb.ColumnID, 0, len(n.Storing)), + Inverted: n.Inverted, + Concurrently: n.Concurrently, + KeySuffixColumnIDs: nil, + ShardedDescriptor: nil, + } + colNames := make([]string, 0, len(n.Columns)) + // Setup the column ID. + for _, columnNode := range n.Columns { + // If the column was just added the new schema changer is not supported. + if b.checkIfNewColumnExistsByName(table.GetID(), columnNode.Column) { + panic(¬ImplementedError{ + detail: "column was added in the current transaction.", + n: n, + }) + } + if columnNode.Expr != nil { + if !b.ClusterSettings().Version.IsActive(ctx, clusterversion.ExpressionIndexes) { + panic(pgerror.Newf(pgcode.FeatureNotSupported, + "version %v must be finalized to use expression indexes", + clusterversion.ExpressionIndexes)) + } + _, typ, _, err := b.DescUtils().DequalifyAndValidateExpr( + ctx, + table, + columnNode.Expr, + types.Any, + "index expression", + semaCtx(b), + tree.VolatilityImmutable, + &n.Table, + ) + if err != nil { + panic(err) + } + // Create a new virtual column and add it to the table + // descriptor. + colName := tabledesc.GenerateUniqueName("crdb_idx_expr", func(name string) bool { + _, err := table.FindColumnWithName(tree.Name(name)) + return err == nil + }) + addCol := &tree.AlterTableAddColumn{ + ColumnDef: &tree.ColumnTableDef{ + Name: tree.Name(colName), + Type: typ, + Hidden: true, + }, + } + addCol.ColumnDef.Computed.Computed = true + addCol.ColumnDef.Computed.Expr = columnNode.Expr + addCol.ColumnDef.Computed.Virtual = true + addCol.ColumnDef.Nullable.Nullability = tree.Null + + // Add a new column element + b.alterTableAddColumn(ctx, table, addCol, &n.Table) + var addColumn *scpb.Column = nil + for _, node := range b.output { + if node.Target.Column != nil && + node.Target.Column.TableID == table.GetID() && + node.Target.Column.Column.Name == colName { + addColumn = node.Target.Column + } + } + + // Set up the index based on the new column + colNames = append(colNames, colName) + secondaryIndex.KeyColumnIDs = append(secondaryIndex.KeyColumnIDs, addColumn.Column.ID) + continue + + } + if columnNode.Expr == nil { + column, err := table.FindColumnWithName(columnNode.Column) + if err != nil { + panic(err) + } + colNames = append(colNames, column.GetName()) + secondaryIndex.KeyColumnIDs = append(secondaryIndex.KeyColumnIDs, column.GetID()) + } + // Convert the key column directions. + switch columnNode.Direction { + case tree.Ascending, tree.DefaultDirection: + secondaryIndex.KeyColumnDirections = append(secondaryIndex.KeyColumnDirections, scpb.SecondaryIndex_ASC) + case tree.Descending: + secondaryIndex.KeyColumnDirections = append(secondaryIndex.KeyColumnDirections, scpb.SecondaryIndex_DESC) + default: + panic(errors.AssertionFailedf("Unknown direction type %s", columnNode.Direction)) + } + } + // Setup the storing columns + for _, storingNode := range n.Storing { + column, err := table.FindColumnWithName(storingNode) + if err != nil { + panic(err) + } + secondaryIndex.StoringColumnIDs = append(secondaryIndex.StoringColumnIDs, column.GetID()) + } + if n.Sharded != nil { + if n.PartitionByIndex.ContainsPartitions() { + panic(pgerror.New(pgcode.FeatureNotSupported, "sharded indexes don't support partitioning")) + } + if table.IsLocalityRegionalByRow() { + panic(pgerror.New(pgcode.FeatureNotSupported, "hash sharded indexes are not compatible with REGIONAL BY ROW tables")) + } + if n.Interleave != nil { + panic(pgerror.New(pgcode.FeatureNotSupported, "interleaved indexes cannot also be hash sharded")) + } + buckets, err := b.DescUtils().EvalShardBucketCount(ctx, semaCtx(b), evalCtx(ctx, b), n.Sharded.ShardBuckets) + if err != nil { + panic(err) + } + shardColName := tabledesc.GetShardColumnName(colNames, buckets) + _, err = b.maybeCreateAndAddShardCol(int(buckets), table, colNames, false) + if err != nil { + panic(err) + } + secondaryIndex.ShardedDescriptor = &descpb.ShardedDescriptor{ + IsSharded: true, + Name: shardColName, + ShardBuckets: buckets, + ColumnNames: colNames, + } + } + // Assign the ID here, since we may have added columns + // and made a new primary key above. + secondaryIndex.IndexId = b.nextIndexID(table) + // Convert partitioning information for the execution + // side of things. + if n.PartitionByIndex.ContainsPartitions() { + listPartitions := make([]*scpb.ListPartition, 0, len(n.PartitionByIndex.List)) + for _, partition := range n.PartitionByIndex.List { + exprs := make([]string, 0, len(partition.Exprs)) + for _, expr := range partition.Exprs { + exprs = append(exprs, expr.String()) + } + listPartition := &scpb.ListPartition{ + Name: partition.Name.String(), + Expr: exprs, + } + listPartitions = append(listPartitions, listPartition) + } + rangePartitions := make([]*scpb.RangePartitions, 0, len(n.PartitionByIndex.Range)) + for _, partition := range n.PartitionByIndex.Range { + toExpr := make([]string, 0, len(partition.To)) + for _, expr := range partition.To { + fmtCtx := tree.NewFmtCtx(tree.FmtSimple) + fmtCtx.FormatNode(expr) + toExpr = append(toExpr, fmtCtx.String()) + } + fromExpr := make([]string, 0, len(partition.From)) + for _, expr := range partition.From { + fmtCtx := tree.NewFmtCtx(tree.FmtSimple) + fmtCtx.FormatNode(expr) + fromExpr = append(fromExpr, fmtCtx.String()) + } + rangePartition := &scpb.RangePartitions{ + Name: partition.Name.String(), + To: toExpr, + From: fromExpr, + } + rangePartitions = append(rangePartitions, rangePartition) + } + fields := make([]string, 0, len(n.PartitionByIndex.Fields)) + for _, field := range n.PartitionByIndex.Fields { + fields = append(fields, field.String()) + } + partitioning := &scpb.Partitioning{ + TableID: table.GetID(), + IndexId: secondaryIndex.IndexId, + Fields: fields, + ListPartitions: listPartitions, + RangePartitions: rangePartitions, + } + b.addNode(scpb.Target_ADD, + partitioning) + } + + // KeySuffixColumnIDs is only populated for indexes using the secondary + // index encoding. It is the set difference of the primary key minus the + // index's key. + colIDs := catalog.MakeTableColSet(secondaryIndex.KeyColumnIDs...) + var extraColumnIDs []descpb.ColumnID + for _, primaryColID := range table.GetPrimaryIndex().IndexDesc().KeyColumnIDs { + if !colIDs.Contains(primaryColID) { + extraColumnIDs = append(extraColumnIDs, primaryColID) + colIDs.Add(primaryColID) + } + } + secondaryIndex.KeySuffixColumnIDs = extraColumnIDs + + b.addNode(scpb.Target_ADD, + secondaryIndex) +} diff --git a/pkg/sql/schemachanger/scbuild/table.go b/pkg/sql/schemachanger/scbuild/table.go index bc2c31a99878..f8203bd5d644 100644 --- a/pkg/sql/schemachanger/scbuild/table.go +++ b/pkg/sql/schemachanger/scbuild/table.go @@ -69,6 +69,68 @@ func (b *buildContext) alterTableCmd( } } +func primaryIndexElemFromDescriptor( + indexDesc *descpb.IndexDescriptor, tableDesc catalog.TableDescriptor, +) *scpb.PrimaryIndex { + if len(indexDesc.Partitioning.Range) > 0 || + len(indexDesc.Partitioning.List) > 0 { + panic(notImplementedError{n: nil, detail: "partitioning on new indexes is not supported."}) + } + keyColumnDirs := make([]scpb.PrimaryIndex_Direction, 0, len(indexDesc.KeyColumnDirections)) + for _, dir := range indexDesc.KeyColumnDirections { + switch dir { + case descpb.IndexDescriptor_DESC: + keyColumnDirs = append(keyColumnDirs, scpb.PrimaryIndex_DESC) + case descpb.IndexDescriptor_ASC: + keyColumnDirs = append(keyColumnDirs, scpb.PrimaryIndex_ASC) + default: + panic(errors.AssertionFailedf("Unknown direction type %s", dir)) + } + } + return &scpb.PrimaryIndex{TableID: tableDesc.GetID(), + IndexId: indexDesc.ID, + IndexName: indexDesc.Name, + Unique: indexDesc.Unique, + KeyColumnIDs: indexDesc.KeyColumnIDs, + KeyColumnDirections: keyColumnDirs, + KeySuffixColumnIDs: indexDesc.KeySuffixColumnIDs, + StoringColumnIDs: indexDesc.StoreColumnIDs, + CompositeColumnIDs: indexDesc.CompositeColumnIDs, + Inverted: indexDesc.Type == descpb.IndexDescriptor_INVERTED, + ShardedDescriptor: &indexDesc.Sharded} +} + +func secondaryIndexElemFromDescriptor( + indexDesc *descpb.IndexDescriptor, tableDesc catalog.TableDescriptor, +) *scpb.SecondaryIndex { + if len(indexDesc.Partitioning.Range) > 0 || + len(indexDesc.Partitioning.List) > 0 { + panic(notImplementedError{n: nil, detail: "partitioning on new indexes is not supported."}) + } + keyColumnDirs := make([]scpb.SecondaryIndex_Direction, 0, len(indexDesc.KeyColumnDirections)) + for _, dir := range indexDesc.KeyColumnDirections { + switch dir { + case descpb.IndexDescriptor_DESC: + keyColumnDirs = append(keyColumnDirs, scpb.SecondaryIndex_DESC) + case descpb.IndexDescriptor_ASC: + keyColumnDirs = append(keyColumnDirs, scpb.SecondaryIndex_ASC) + default: + panic(errors.AssertionFailedf("Unknown direction type %s", dir)) + } + } + return &scpb.SecondaryIndex{TableID: tableDesc.GetID(), + IndexId: indexDesc.ID, + IndexName: indexDesc.Name, + Unique: indexDesc.Unique, + KeyColumnIDs: indexDesc.KeyColumnIDs, + KeyColumnDirections: keyColumnDirs, + KeySuffixColumnIDs: indexDesc.KeySuffixColumnIDs, + StoringColumnIDs: indexDesc.StoreColumnIDs, + CompositeColumnIDs: indexDesc.CompositeColumnIDs, + Inverted: indexDesc.Type == descpb.IndexDescriptor_INVERTED, + ShardedDescriptor: &indexDesc.Sharded} +} + func (b *buildContext) alterTableAddColumn( ctx context.Context, table catalog.TableDescriptor, @@ -132,7 +194,7 @@ func (b *buildContext) alterTableAddColumn( familyID = b.findOrAddColumnFamily( table, familyName, d.Family.Create, d.Family.IfNotExists, ) - } else { + } else if !d.IsVirtual() { // FIXME: Compute columns should not have families? // TODO(ajwerner,lucy-zhang): Deal with adding the first column to the // table. fam := table.GetFamilies()[0] @@ -179,16 +241,12 @@ func (b *buildContext) alterTableAddColumn( FamilyID: familyID, FamilyName: familyName, }) - newPrimaryIdxID := b.addOrUpdatePrimaryIndexTargetsForAddColumn(table, colID, col.Name) - + b.addOrUpdatePrimaryIndexTargetsForAddColumn(table, colID, col.Name) if idx := cdd.PrimaryKeyOrUniqueIndexDescriptor; idx != nil { idxID := b.nextIndexID(table) idx.ID = idxID - b.addNode(scpb.Target_ADD, &scpb.SecondaryIndex{ - TableID: table.GetID(), - Index: *idx, - PrimaryIndex: newPrimaryIdxID, - }) + secondaryIndex := secondaryIndexElemFromDescriptor(idx, table) + b.addNode(scpb.Target_ADD, secondaryIndex) } } @@ -395,9 +453,8 @@ func (b *buildContext) addOrUpdatePrimaryIndexTargetsForAddColumn( if t, ok := n.Element().(*scpb.PrimaryIndex); ok && b.output[i].Target.Direction == scpb.Target_ADD && t.TableID == table.GetID() { - t.Index.StoreColumnIDs = append(t.Index.StoreColumnIDs, colID) - t.Index.StoreColumnNames = append(t.Index.StoreColumnNames, colName) - return t.Index.ID + t.StoringColumnIDs = append(t.StoringColumnIDs, colID) + return t.IndexId } } @@ -421,18 +478,10 @@ func (b *buildContext) addOrUpdatePrimaryIndexTargetsForAddColumn( newIdx.StoreColumnNames = append(newIdx.StoreColumnNames, colName) } - b.addNode(scpb.Target_ADD, &scpb.PrimaryIndex{ - TableID: table.GetID(), - Index: newIdx, - OtherPrimaryIndexID: table.GetPrimaryIndexID(), - }) + b.addNode(scpb.Target_ADD, primaryIndexElemFromDescriptor(&newIdx, table)) // Drop the existing primary index. - b.addNode(scpb.Target_DROP, &scpb.PrimaryIndex{ - TableID: table.GetID(), - Index: table.GetPrimaryIndex().IndexDescDeepCopy(), - OtherPrimaryIndexID: newIdx.ID, - }) + b.addNode(scpb.Target_DROP, primaryIndexElemFromDescriptor(table.GetPrimaryIndex().IndexDesc(), table)) return idxID } @@ -447,11 +496,10 @@ func (b *buildContext) addOrUpdatePrimaryIndexTargetsForDropColumn( if t, ok := n.Element().(*scpb.PrimaryIndex); ok && n.Target.Direction == scpb.Target_ADD && t.TableID == table.GetID() { - for j := range t.Index.StoreColumnIDs { - if t.Index.StoreColumnIDs[j] == colID { - t.Index.StoreColumnIDs = append(t.Index.StoreColumnIDs[:j], t.Index.StoreColumnIDs[j+1:]...) - t.Index.StoreColumnNames = append(t.Index.StoreColumnNames[:j], t.Index.StoreColumnNames[j+1:]...) - return t.Index.ID + for j := range t.StoringColumnIDs { + if t.StoringColumnIDs[j] == colID { + t.StoringColumnIDs = append(t.StoringColumnIDs[:j], t.StoringColumnIDs[j+1:]...) + return t.IndexId } panic("index not found") @@ -487,18 +535,10 @@ func (b *buildContext) addOrUpdatePrimaryIndexTargetsForDropColumn( } } - b.addNode(scpb.Target_ADD, &scpb.PrimaryIndex{ - TableID: table.GetID(), - Index: newIdx, - OtherPrimaryIndexID: table.GetPrimaryIndexID(), - }) + b.addNode(scpb.Target_ADD, primaryIndexElemFromDescriptor(&newIdx, table)) // Drop the existing primary index. - b.addNode(scpb.Target_DROP, &scpb.PrimaryIndex{ - TableID: table.GetID(), - Index: table.GetPrimaryIndex().IndexDescDeepCopy(), - OtherPrimaryIndexID: idxID, - }) + b.addNode(scpb.Target_DROP, primaryIndexElemFromDescriptor(table.GetPrimaryIndex().IndexDesc(), table)) return idxID } @@ -534,12 +574,12 @@ func (b *buildContext) nextIndexID(table catalog.TableDescriptor) descpb.IndexID continue } if ai, ok := n.Element().(*scpb.SecondaryIndex); ok { - if ai.Index.ID > maxIdxID { - maxIdxID = ai.Index.ID + if ai.IndexId > maxIdxID { + maxIdxID = ai.IndexId } } else if ai, ok := n.Element().(*scpb.PrimaryIndex); ok { - if ai.Index.ID > maxIdxID { - maxIdxID = ai.Index.ID + if ai.IndexId > maxIdxID { + maxIdxID = ai.IndexId } } } diff --git a/pkg/sql/schemachanger/scbuild/testdata/create_index b/pkg/sql/schemachanger/scbuild/testdata/create_index new file mode 100644 index 000000000000..471677801644 --- /dev/null +++ b/pkg/sql/schemachanger/scbuild/testdata/create_index @@ -0,0 +1,144 @@ +create-table +CREATE TABLE defaultdb.t1 (id INT PRIMARY KEY, name varchar(256), money int) +---- + +build +CREATE INDEX id1 on defaultdb.t1(id, name) storing (money) +---- +- ADD SecondaryIndex:{DescID: 52, ElementName: "id1", IndexID: 2} + state: ABSENT + details: + indexId: 2 + indexName: id1 + keyColumnDirection: + - ASC + - ASC + keyColumnIds: + - 1 + - 2 + storingColumnIds: + - 3 + tableId: 52 + +build +CREATE INVERTED INDEX concurrently id1 on defaultdb.t1(id, name) storing (money) +---- +- ADD SecondaryIndex:{DescID: 52, ElementName: "id1", IndexID: 2} + state: ABSENT + details: + concurrently: true + indexId: 2 + indexName: id1 + inverted: true + keyColumnDirection: + - ASC + - ASC + keyColumnIds: + - 1 + - 2 + storingColumnIds: + - 3 + tableId: 52 + +build +CREATE INDEX id1 on defaultdb.t1(id, name) storing (money) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1) + ) +---- +- ADD Partitioning:{DescID: 52, IndexID: 2} + state: ABSENT + details: + fields: + - id + indexId: 2 + listPartitions: + - expr: + - "1" + name: p1 + rangePartitions: [] + tableId: 52 +- ADD SecondaryIndex:{DescID: 52, ElementName: "id1", IndexID: 2} + state: ABSENT + details: + indexId: 2 + indexName: id1 + keyColumnDirection: + - ASC + - ASC + keyColumnIds: + - 1 + - 2 + storingColumnIds: + - 3 + tableId: 52 + +build +CREATE INDEX id1 on defaultdb.t1(id, name) USING HASH WITH BUCKET_COUNT=8 storing (money); +---- +- ADD Column:{DescID: 52, ColumnID: 4, ElementName: "crdb_internal_id_name_shard_8"} + state: ABSENT + details: + column: + computeExpr: mod(fnv32(COALESCE(CAST(id AS STRING), '':::STRING)) + fnv32(COALESCE(CAST(name + AS STRING), '':::STRING)), 8:::INT8) + hidden: true + id: 4 + name: crdb_internal_id_name_shard_8 + type: + family: IntFamily + oid: 23 + width: 32 + familyName: primary + tableId: 52 +- ADD PrimaryIndex:{DescID: 52, ElementName: "new_primary_key", IndexID: 2} + state: ABSENT + details: + indexId: 2 + indexName: new_primary_key + keyColumnDirection: + - ASC + keyColumnIds: + - 1 + shardedDescriptor: {} + storingColumnIds: + - 2 + - 3 + - 4 + tableId: 52 + unique: true +- ADD SecondaryIndex:{DescID: 52, ElementName: "id1", IndexID: 3} + state: ABSENT + details: + indexId: 3 + indexName: id1 + keyColumnDirection: + - ASC + - ASC + keyColumnIds: + - 1 + - 2 + shardedDescriptor: + columnNames: + - id + - name + isSharded: true + name: crdb_internal_id_name_shard_8 + shardBuckets: 8 + storingColumnIds: + - 3 + tableId: 52 +- DROP PrimaryIndex:{DescID: 52, ElementName: "primary", IndexID: 1} + state: PUBLIC + details: + indexId: 1 + indexName: primary + keyColumnDirection: + - ASC + keyColumnIds: + - 1 + shardedDescriptor: {} + storingColumnIds: + - 2 + - 3 + tableId: 52 + unique: true diff --git a/pkg/sql/schemachanger/scdeps/build_deps.go b/pkg/sql/schemachanger/scdeps/build_deps.go index e4ddcbb8f294..26180c5d00bb 100644 --- a/pkg/sql/schemachanger/scdeps/build_deps.go +++ b/pkg/sql/schemachanger/scdeps/build_deps.go @@ -20,6 +20,8 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" "github.com/cockroachdb/cockroach/pkg/sql/catalog/descs" "github.com/cockroachdb/cockroach/pkg/sql/catalog/resolver" + "github.com/cockroachdb/cockroach/pkg/sql/catalog/schemaexpr" + "github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc" "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scbuild" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" @@ -60,6 +62,8 @@ type buildDeps struct { sessionData *sessiondata.SessionData settings *cluster.Settings statements []string + semaCtx *tree.SemaContext + evalCtx *tree.EvalContext } var _ scbuild.CatalogReader = (*buildDeps)(nil) @@ -204,6 +208,11 @@ func (d *buildDeps) CatalogReader() scbuild.CatalogReader { return d } +// DescUtils implements the scbuild.Dependencies interface. +func (d *buildDeps) DescUtils() scbuild.DescUtils { + return d +} + // Codec implements the scbuild.Dependencies interface. func (d *buildDeps) Codec() keys.SQLCodec { return d.codec @@ -223,3 +232,21 @@ func (d *buildDeps) ClusterSettings() *cluster.Settings { func (d *buildDeps) Statements() []string { return d.statements } + +func (d *buildDeps) EvalShardBucketCount( + ctx context.Context, shardBuckets tree.Expr, +) (int32, error) { + return tabledesc.EvalShardBucketCount(ctx, d.semaCtx, d.evalCtx, shardBuckets) +} + +func (d *buildDeps) DequalifyAndValidateExpr( + ctx context.Context, + desc catalog.TableDescriptor, + expr tree.Expr, + typ *types.T, + context string, + maxVolatility tree.Volatility, + tn *tree.TableName, +) (string, *types.T, catalog.TableColSet, error) { + return schemaexpr.DequalifyAndValidateExpr(ctx, desc, expr, typ, context, d.semaCtx, maxVolatility, tn) +} diff --git a/pkg/sql/schemachanger/scdeps/exec_deps.go b/pkg/sql/schemachanger/scdeps/exec_deps.go index 0ccf99a49ffc..0359f09af519 100644 --- a/pkg/sql/schemachanger/scdeps/exec_deps.go +++ b/pkg/sql/schemachanger/scdeps/exec_deps.go @@ -19,12 +19,17 @@ import ( "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/kv" "github.com/cockroachdb/cockroach/pkg/roachpb" + "github.com/cockroachdb/cockroach/pkg/settings/cluster" "github.com/cockroachdb/cockroach/pkg/sql/catalog" "github.com/cockroachdb/cockroach/pkg/sql/catalog/catalogkeys" "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" "github.com/cockroachdb/cockroach/pkg/sql/catalog/descs" + "github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc" + "github.com/cockroachdb/cockroach/pkg/sql/parser" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scbuild" "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec" "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scop" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/errors" ) @@ -60,6 +65,8 @@ type txnDeps struct { codec keys.SQLCodec descsCollection *descs.Collection jobRegistry *jobs.Registry + st *cluster.Settings + evalCtx *tree.EvalContext } var _ scexec.Catalog = (*txnDeps)(nil) @@ -88,6 +95,61 @@ func (d *txnDeps) RemoveSyntheticDescriptor(id descpb.ID) { d.descsCollection.RemoveSyntheticDescriptor(id) } +// AddPartitioning implements the scmutationexec.CatalogReader interface. +func (d *txnDeps) AddPartitioning( + tableDesc *tabledesc.Mutable, + indexDesc *descpb.IndexDescriptor, + partitionFields []string, + listPartition []*scpb.ListPartition, + rangePartition []*scpb.RangePartitions, + allowedNewColumnNames []tree.Name, + allowImplicitPartitioning bool, +) error { + ctx := context.Background() + // Deserialize back into tree based types + partitionBy := &tree.PartitionBy{} + partitionBy.List = make([]tree.ListPartition, 0, len(listPartition)) + partitionBy.Range = make([]tree.RangePartition, 0, len(rangePartition)) + for _, partition := range listPartition { + exprs, err := parser.ParseExprs(partition.Expr) + if err != nil { + return err + } + partitionBy.List = append(partitionBy.List, + tree.ListPartition{ + Name: tree.UnrestrictedName(partition.Name), + Exprs: exprs, + }) + } + for _, partition := range rangePartition { + toExpr, err := parser.ParseExprs(partition.To) + if err != nil { + return err + } + fromExpr, err := parser.ParseExprs(partition.From) + if err != nil { + return err + } + partitionBy.Range = append(partitionBy.Range, + tree.RangePartition{ + Name: tree.UnrestrictedName(partition.Name), + To: toExpr, + From: fromExpr, + }) + } + partitionBy.Fields = make(tree.NameList, 0, len(partitionFields)) + for _, field := range partitionFields { + partitionBy.Fields = append(partitionBy.Fields, tree.Name(field)) + } + // Create the paritioning + newImplicitCols, newPartitioning, err := scbuild.CreatePartitioningCCL(ctx, d.st, d.evalCtx, tableDesc, *indexDesc, partitionBy, allowedNewColumnNames, allowImplicitPartitioning) + if err != nil { + return err + } + tabledesc.UpdateIndexPartitioning(indexDesc, false, newImplicitCols, newPartitioning) + return nil +} + // MustReadMutableDescriptor implements the scexec.Catalog interface. func (d *txnDeps) MustReadMutableDescriptor( ctx context.Context, id descpb.ID, diff --git a/pkg/sql/schemachanger/scexec/scmutationexec/BUILD.bazel b/pkg/sql/schemachanger/scexec/scmutationexec/BUILD.bazel index 842b5051ae5c..100c2472d334 100644 --- a/pkg/sql/schemachanger/scexec/scmutationexec/BUILD.bazel +++ b/pkg/sql/schemachanger/scexec/scmutationexec/BUILD.bazel @@ -19,6 +19,8 @@ go_library( "//pkg/sql/parser", "//pkg/sql/schemachanger/scexec/descriptorutils", "//pkg/sql/schemachanger/scop", + "//pkg/sql/schemachanger/scpb", + "//pkg/sql/sem/tree", "//pkg/util/protoutil", "@com_github_cockroachdb_errors//:errors", ], diff --git a/pkg/sql/schemachanger/scexec/scmutationexec/scmutationexec.go b/pkg/sql/schemachanger/scexec/scmutationexec/scmutationexec.go index 1feb9105809d..0935628c632d 100644 --- a/pkg/sql/schemachanger/scexec/scmutationexec/scmutationexec.go +++ b/pkg/sql/schemachanger/scexec/scmutationexec/scmutationexec.go @@ -24,6 +24,8 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/parser" "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec/descriptorutils" "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scop" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" + "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/util/protoutil" "github.com/cockroachdb/errors" ) @@ -41,6 +43,17 @@ type CatalogReader interface { // RemoveSyntheticDescriptor undoes the effects of AddSyntheticDescriptor. RemoveSyntheticDescriptor(id descpb.ID) + + // AddPartitioning adds partitioning information on an index descriptor. + AddPartitioning( + tableDesc *tabledesc.Mutable, + indexDesc *descpb.IndexDescriptor, + partitionFields []string, + listPartition []*scpb.ListPartition, + rangePartition []*scpb.RangePartitions, + allowedNewColumnNames []tree.Name, + allowImplicitPartitioning bool, + ) error } // MutationVisitorStateUpdater is the interface for updating the visitor state. @@ -439,33 +452,36 @@ func (m *visitor) MakeAddedColumnDeleteOnly( if err != nil { return err } - // TODO(ajwerner): deal with ordering the indexes or sanity checking this // or what-not. if op.Column.ID >= table.NextColumnID { table.NextColumnID = op.Column.ID + 1 } - var foundFamily bool - for i := range table.Families { - fam := &table.Families[i] - if foundFamily = fam.ID == op.FamilyID; foundFamily { - fam.ColumnIDs = append(fam.ColumnIDs, op.Column.ID) - fam.ColumnNames = append(fam.ColumnNames, op.Column.Name) - break + if !op.Column.IsComputed() || + !op.Column.Virtual { + var foundFamily bool + for i := range table.Families { + fam := &table.Families[i] + if foundFamily = fam.ID == op.FamilyID; foundFamily { + fam.ColumnIDs = append(fam.ColumnIDs, op.Column.ID) + fam.ColumnNames = append(fam.ColumnNames, op.Column.Name) + break + } } - } - if !foundFamily { - table.Families = append(table.Families, descpb.ColumnFamilyDescriptor{ - Name: op.FamilyName, - ID: op.FamilyID, - ColumnNames: []string{op.Column.Name}, - ColumnIDs: []descpb.ColumnID{op.Column.ID}, - }) - sort.Slice(table.Families, func(i, j int) bool { - return table.Families[i].ID < table.Families[j].ID - }) - if table.NextFamilyID <= op.FamilyID { - table.NextFamilyID = op.FamilyID + 1 + // Only create column families for non-computed columns + if !foundFamily { + table.Families = append(table.Families, descpb.ColumnFamilyDescriptor{ + Name: op.FamilyName, + ID: op.FamilyID, + ColumnNames: []string{op.Column.Name}, + ColumnIDs: []descpb.ColumnID{op.Column.ID}, + }) + sort.Slice(table.Families, func(i, j int) bool { + return table.Families[i].ID < table.Families[j].ID + }) + if table.NextFamilyID <= op.FamilyID { + table.NextFamilyID = op.FamilyID + 1 + } } } table.AddColumnMutation(&op.Column, descpb.DescriptorMutation_ADD) @@ -495,34 +511,81 @@ func (m *visitor) MakeDroppedPrimaryIndexDeleteAndWriteOnly( if err != nil { return err } - - // NOTE: There is no ordering guarantee between operations which might - // touch the primary index. Remove it if it has not already been overwritten. - if table.PrimaryIndex.ID == op.Index.ID { - table.PrimaryIndex = descpb.IndexDescriptor{} + if table.PrimaryIndex.ID != op.IndexID { + return errors.AssertionFailedf("index being dropped (%d) does not match existing primary index (%d).", op.IndexID, table.PrimaryIndex.ID) } - - idx := protoutil.Clone(&op.Index).(*descpb.IndexDescriptor) + idx := protoutil.Clone(&table.PrimaryIndex).(*descpb.IndexDescriptor) return table.AddIndexMutation(idx, descpb.DescriptorMutation_DROP) } func (m *visitor) MakeAddedIndexDeleteOnly( ctx context.Context, op scop.MakeAddedIndexDeleteOnly, ) error { - table, err := m.checkOutTable(ctx, op.TableID) if err != nil { return err } - // TODO(ajwerner): deal with ordering the indexes or sanity checking this // or what-not. - if op.Index.ID >= table.NextIndexID { - table.NextIndexID = op.Index.ID + 1 + if op.IndexID >= table.NextIndexID { + table.NextIndexID = op.IndexID + 1 + } + // Resolve column names + colNames := make([]string, 0, len(op.KeyColumnIDs)) + for _, colID := range op.KeyColumnIDs { + column, err := table.FindColumnWithID(colID) + if err != nil { + return err + } + colNames = append(colNames, column.GetName()) + } + storeColNames := make([]string, 0, len(op.StoreColumnIDs)) + for _, colID := range op.StoreColumnIDs { + column, err := table.FindColumnWithID(colID) + if err != nil { + return err + } + storeColNames = append(storeColNames, column.GetName()) + } + // Setup the index descriptor type. + indexType := descpb.IndexDescriptor_FORWARD + if op.Inverted { + indexType = descpb.IndexDescriptor_INVERTED + } + // Setup the encoding type. + encodingType := descpb.PrimaryIndexEncoding + indexVersion := descpb.PrimaryIndexWithStoredColumnsVersion + if op.SecondaryIndex { + encodingType = descpb.SecondaryIndexEncoding + indexVersion = descpb.StrictIndexColumnIDGuaranteesVersion + } + // Create an index descriptor from the the operation. + idx := &descpb.IndexDescriptor{ + Name: op.IndexName, + ID: op.IndexID, + Unique: op.Unique, + Version: indexVersion, + KeyColumnNames: colNames, + KeyColumnIDs: op.KeyColumnIDs, + StoreColumnIDs: op.StoreColumnIDs, + StoreColumnNames: storeColNames, + KeyColumnDirections: op.KeyColumnDirections, + Type: indexType, + KeySuffixColumnIDs: op.KeySuffixColumnIDs, + CompositeColumnIDs: op.CompositeColumnIDs, + CreatedExplicitly: true, + EncodingType: encodingType, + } + if idx.Name == "" { + name, err := tabledesc.BuildIndexName(table, idx) + if err != nil { + return err + } + idx.Name = name + } + if op.ShardedDescriptor != nil { + idx.Sharded = *op.ShardedDescriptor } - // Make some adjustments to the index descriptor so that it behaves correctly - // as a secondary index while being added. - idx := protoutil.Clone(&op.Index).(*descpb.IndexDescriptor) return table.AddIndexMutation(idx, descpb.DescriptorMutation_ADD) } @@ -546,6 +609,28 @@ func (m *visitor) AddCheckConstraint(ctx context.Context, op scop.AddCheckConstr return nil } +func (m *visitor) MakeAddedSecondaryIndexPublic( + ctx context.Context, op scop.MakeAddedSecondaryIndexPublic, +) error { + table, err := m.checkOutTable(ctx, op.TableID) + if err != nil { + return err + } + + for idx, idxMutation := range table.GetMutations() { + if idxMutation.GetIndex() != nil && + idxMutation.GetIndex().ID == op.IndexID { + err := table.MakeMutationComplete(idxMutation) + if err != nil { + return err + } + table.Mutations = append(table.Mutations[:idx], table.Mutations[idx+1:]...) + break + } + } + return nil +} + func (m *visitor) MakeAddedPrimaryIndexPublic( ctx context.Context, op scop.MakeAddedPrimaryIndexPublic, ) error { @@ -553,15 +638,20 @@ func (m *visitor) MakeAddedPrimaryIndexPublic( if err != nil { return err } + index, err := table.FindIndexWithID(op.IndexID) + if err != nil { + return err + } + indexDesc := index.IndexDescDeepCopy() if _, err := removeMutation( ctx, table, - descriptorutils.MakeIndexIDMutationSelector(op.Index.ID), + descriptorutils.MakeIndexIDMutationSelector(op.IndexID), descpb.DescriptorMutation_DELETE_AND_WRITE_ONLY, ); err != nil { return err } - table.PrimaryIndex = *(protoutil.Clone(&op.Index)).(*descpb.IndexDescriptor) + table.PrimaryIndex = indexDesc return nil } @@ -617,4 +707,16 @@ func (m *visitor) DropForeignKeyRef(ctx context.Context, op scop.DropForeignKeyR return nil } +func (m *visitor) AddIndexPartitionInfo(ctx context.Context, op scop.AddIndexPartitionInfo) error { + table, err := m.checkOutTable(ctx, op.TableID) + if err != nil { + return err + } + index, err := table.FindIndexWithID(op.IndexID) + if err != nil { + return err + } + return m.cr.AddPartitioning(table, index.IndexDesc(), op.PartitionFields, op.ListPartitions, op.RangePartitions, nil, true) +} + var _ scop.MutationVisitor = (*visitor)(nil) diff --git a/pkg/sql/schemachanger/scop/BUILD.bazel b/pkg/sql/schemachanger/scop/BUILD.bazel index cf10b6aafcbd..d66fe8b11da3 100644 --- a/pkg/sql/schemachanger/scop/BUILD.bazel +++ b/pkg/sql/schemachanger/scop/BUILD.bazel @@ -19,6 +19,7 @@ go_library( visibility = ["//visibility:public"], deps = [ "//pkg/sql/catalog/descpb", + "//pkg/sql/schemachanger/scpb", "@com_github_cockroachdb_errors//:errors", ], ) diff --git a/pkg/sql/schemachanger/scop/mutation.go b/pkg/sql/schemachanger/scop/mutation.go index af341189be6b..346010fbbbfb 100644 --- a/pkg/sql/schemachanger/scop/mutation.go +++ b/pkg/sql/schemachanger/scop/mutation.go @@ -10,7 +10,10 @@ package scop -import "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" +import ( + "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" +) //go:generate go run ./generate_visitor.go scop Mutation mutation.go mutation_visitor_generated.go @@ -28,7 +31,19 @@ type MakeAddedIndexDeleteOnly struct { TableID descpb.ID // Index represents the index as it should appear in the mutation. - Index descpb.IndexDescriptor + PrimaryIndex descpb.IndexID + IndexID descpb.IndexID + IndexName string + Unique bool + KeyColumnIDs []descpb.ColumnID + KeyColumnDirections []descpb.IndexDescriptor_Direction + KeySuffixColumnIDs []descpb.ColumnID + StoreColumnIDs []descpb.ColumnID + CompositeColumnIDs []descpb.ColumnID + ShardedDescriptor *descpb.ShardedDescriptor + Inverted bool + Concurrently bool + SecondaryIndex bool } // MakeAddedIndexDeleteAndWriteOnly transitions an index addition mutation from @@ -39,12 +54,20 @@ type MakeAddedIndexDeleteAndWriteOnly struct { IndexID descpb.IndexID } +// MakeAddedSecondaryIndexPublic moves a new primary index from its mutation to +// public. +type MakeAddedSecondaryIndexPublic struct { + mutationOp + TableID descpb.ID + IndexID descpb.IndexID +} + // MakeAddedPrimaryIndexPublic moves a new primary index from its mutation to // public. type MakeAddedPrimaryIndexPublic struct { mutationOp TableID descpb.ID - Index descpb.IndexDescriptor + IndexID descpb.IndexID } // MakeDroppedPrimaryIndexDeleteAndWriteOnly moves a dropped primary index from @@ -53,11 +76,11 @@ type MakeDroppedPrimaryIndexDeleteAndWriteOnly struct { mutationOp TableID descpb.ID - // Index is the descriptor as it should be added as part of the mutation. The + // IndexID is the descriptor as it should be added as part of the mutation. The // primary index of a table has a slightly different encoding than that of // a secondary index. The value here sets it as it should be when adding // the mutation, including the stored columns. - Index descpb.IndexDescriptor + IndexID descpb.IndexID } // CreateGcJobForDescriptor creates a GC job for a given descriptor. @@ -119,6 +142,8 @@ type RemoveTypeBackRef struct { TypeID descpb.ID } +// FIXME: Check create index first + // MakeAddedColumnDeleteAndWriteOnly transitions a column addition mutation from // DELETE_ONLY to DELETE_AND_WRITE_ONLY. type MakeAddedColumnDeleteAndWriteOnly struct { @@ -227,3 +252,14 @@ type RemoveSequenceOwnedBy struct { mutationOp TableID descpb.ID } + +// AddIndexPartitionInfo adds partitoning information into +// an index +type AddIndexPartitionInfo struct { + mutationOp + TableID descpb.ID + IndexID descpb.IndexID + PartitionFields []string + ListPartitions []*scpb.ListPartition + RangePartitions []*scpb.RangePartitions +} diff --git a/pkg/sql/schemachanger/scop/mutation_visitor_generated.go b/pkg/sql/schemachanger/scop/mutation_visitor_generated.go index d7f7d831f43c..6ee24e59c69d 100644 --- a/pkg/sql/schemachanger/scop/mutation_visitor_generated.go +++ b/pkg/sql/schemachanger/scop/mutation_visitor_generated.go @@ -24,6 +24,7 @@ type MutationOp interface { type MutationVisitor interface { MakeAddedIndexDeleteOnly(context.Context, MakeAddedIndexDeleteOnly) error MakeAddedIndexDeleteAndWriteOnly(context.Context, MakeAddedIndexDeleteAndWriteOnly) error + MakeAddedSecondaryIndexPublic(context.Context, MakeAddedSecondaryIndexPublic) error MakeAddedPrimaryIndexPublic(context.Context, MakeAddedPrimaryIndexPublic) error MakeDroppedPrimaryIndexDeleteAndWriteOnly(context.Context, MakeDroppedPrimaryIndexDeleteAndWriteOnly) error CreateGcJobForDescriptor(context.Context, CreateGcJobForDescriptor) error @@ -48,6 +49,7 @@ type MutationVisitor interface { AddColumnFamily(context.Context, AddColumnFamily) error DropForeignKeyRef(context.Context, DropForeignKeyRef) error RemoveSequenceOwnedBy(context.Context, RemoveSequenceOwnedBy) error + AddIndexPartitionInfo(context.Context, AddIndexPartitionInfo) error } // Visit is part of the MutationOp interface. @@ -60,6 +62,11 @@ func (op MakeAddedIndexDeleteAndWriteOnly) Visit(ctx context.Context, v Mutation return v.MakeAddedIndexDeleteAndWriteOnly(ctx, op) } +// Visit is part of the MutationOp interface. +func (op MakeAddedSecondaryIndexPublic) Visit(ctx context.Context, v MutationVisitor) error { + return v.MakeAddedSecondaryIndexPublic(ctx, op) +} + // Visit is part of the MutationOp interface. func (op MakeAddedPrimaryIndexPublic) Visit(ctx context.Context, v MutationVisitor) error { return v.MakeAddedPrimaryIndexPublic(ctx, op) @@ -179,3 +186,8 @@ func (op DropForeignKeyRef) Visit(ctx context.Context, v MutationVisitor) error func (op RemoveSequenceOwnedBy) Visit(ctx context.Context, v MutationVisitor) error { return v.RemoveSequenceOwnedBy(ctx, op) } + +// Visit is part of the MutationOp interface. +func (op AddIndexPartitionInfo) Visit(ctx context.Context, v MutationVisitor) error { + return v.AddIndexPartitionInfo(ctx, op) +} diff --git a/pkg/sql/schemachanger/scop/validation.go b/pkg/sql/schemachanger/scop/validation.go index 827b43d104c3..7d7528377631 100644 --- a/pkg/sql/schemachanger/scop/validation.go +++ b/pkg/sql/schemachanger/scop/validation.go @@ -21,9 +21,8 @@ func (validationOp) Type() Type { return ValidationType } // ValidateUniqueIndex validates uniqueness of entries for a unique index. type ValidateUniqueIndex struct { validationOp - TableID descpb.ID - PrimaryIndexID descpb.IndexID - IndexID descpb.IndexID + TableID descpb.ID + IndexID descpb.IndexID } // ValidateCheckConstraint validates a check constraint on a table's columns. diff --git a/pkg/sql/schemachanger/scpb/elements_generated.go b/pkg/sql/schemachanger/scpb/elements_generated.go index 432ecbf05e4b..d050e6fcb13b 100755 --- a/pkg/sql/schemachanger/scpb/elements_generated.go +++ b/pkg/sql/schemachanger/scpb/elements_generated.go @@ -29,4 +29,5 @@ func (e RelationDependedOnBy) element() {} func (e SequenceOwnedBy) element() {} func (e Type) element() {} func (e Schema) element() {} -func (e Database) element() {} \ No newline at end of file +func (e Database) element() {} +func (e Partitioning) element() {} \ No newline at end of file diff --git a/pkg/sql/schemachanger/scpb/scpb.pb.go b/pkg/sql/schemachanger/scpb/scpb.pb.go index 385c358ce306..50df1820619e 100644 --- a/pkg/sql/schemachanger/scpb/scpb.pb.go +++ b/pkg/sql/schemachanger/scpb/scpb.pb.go @@ -99,6 +99,58 @@ func (Target_Direction) EnumDescriptor() ([]byte, []int) { return fileDescriptor_5413c88842564e28, []int{1, 0} } +// The direction of a column in the index. +type PrimaryIndex_Direction int32 + +const ( + PrimaryIndex_ASC PrimaryIndex_Direction = 0 + PrimaryIndex_DESC PrimaryIndex_Direction = 1 +) + +var PrimaryIndex_Direction_name = map[int32]string{ + 0: "ASC", + 1: "DESC", +} + +var PrimaryIndex_Direction_value = map[string]int32{ + "ASC": 0, + "DESC": 1, +} + +func (x PrimaryIndex_Direction) String() string { + return proto.EnumName(PrimaryIndex_Direction_name, int32(x)) +} + +func (PrimaryIndex_Direction) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5413c88842564e28, []int{3, 0} +} + +// The direction of a column in the index. +type SecondaryIndex_Direction int32 + +const ( + SecondaryIndex_ASC SecondaryIndex_Direction = 0 + SecondaryIndex_DESC SecondaryIndex_Direction = 1 +) + +var SecondaryIndex_Direction_name = map[int32]string{ + 0: "ASC", + 1: "DESC", +} + +var SecondaryIndex_Direction_value = map[string]int32{ + "ASC": 0, + "DESC": 1, +} + +func (x SecondaryIndex_Direction) String() string { + return proto.EnumName(SecondaryIndex_Direction_name, int32(x)) +} + +func (SecondaryIndex_Direction) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5413c88842564e28, []int{4, 0} +} + type SequenceDependency_Type int32 const ( @@ -146,6 +198,7 @@ type ElementProto struct { Type *Type `protobuf:"bytes,16,opt,name=type,proto3" json:"type,omitempty"` Schema *Schema `protobuf:"bytes,17,opt,name=schema,proto3" json:"schema,omitempty"` Database *Database `protobuf:"bytes,18,opt,name=database,proto3" json:"database,omitempty"` + Partitioning *Partitioning `protobuf:"bytes,19,opt,name=partitioning,proto3" json:"partitioning,omitempty"` } func (m *ElementProto) Reset() { *m = ElementProto{} } @@ -248,9 +301,18 @@ func (m *Column) XXX_DiscardUnknown() { var xxx_messageInfo_Column proto.InternalMessageInfo type PrimaryIndex struct { - TableID github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID `protobuf:"varint,1,opt,name=table_id,json=tableId,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ID" json:"table_id,omitempty"` - Index descpb.IndexDescriptor `protobuf:"bytes,2,opt,name=index,proto3" json:"index"` - OtherPrimaryIndexID github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.IndexID `protobuf:"varint,3,opt,name=other_primary_index_id,json=otherPrimaryIndexId,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.IndexID" json:"other_primary_index_id,omitempty"` + TableID github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID `protobuf:"varint,1,opt,name=table_id,json=tableId,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ID" json:"table_id,omitempty"` + IndexId github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.IndexID `protobuf:"varint,2,opt,name=index_id,json=indexId,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.IndexID" json:"index_id,omitempty"` + IndexName string `protobuf:"bytes,3,opt,name=index_name,json=indexName,proto3" json:"index_name,omitempty"` + Unique bool `protobuf:"varint,4,opt,name=unique,proto3" json:"unique,omitempty"` + KeyColumnIDs []github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID `protobuf:"varint,5,rep,packed,name=key_column_ids,json=keyColumnIds,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID" json:"key_column_ids,omitempty"` + KeyColumnDirections []PrimaryIndex_Direction `protobuf:"varint,6,rep,packed,name=key_column_direction,json=keyColumnDirection,proto3,enum=cockroach.sql.schemachanger.scpb.PrimaryIndex_Direction" json:"key_column_direction,omitempty"` + KeySuffixColumnIDs []github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID `protobuf:"varint,7,rep,packed,name=key_suffix_column_ids,json=keySuffixColumnIds,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID" json:"key_suffix_column_ids,omitempty"` + ShardedDescriptor *descpb.ShardedDescriptor `protobuf:"bytes,8,opt,name=sharded_descriptor,json=shardedDescriptor,proto3" json:"sharded_descriptor,omitempty"` + StoringColumnIDs []github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID `protobuf:"varint,9,rep,packed,name=storing_column_ids,json=storingColumnIds,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID" json:"storing_column_ids,omitempty"` + CompositeColumnIDs []github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID `protobuf:"varint,10,rep,packed,name=composite_column_ids,json=compositeColumnIds,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID" json:"composite_column_ids,omitempty"` + Inverted bool `protobuf:"varint,11,opt,name=inverted,proto3" json:"inverted,omitempty"` + Concurrently bool `protobuf:"varint,12,opt,name=concurrently,proto3" json:"concurrently,omitempty"` } func (m *PrimaryIndex) Reset() { *m = PrimaryIndex{} } @@ -283,9 +345,18 @@ func (m *PrimaryIndex) XXX_DiscardUnknown() { var xxx_messageInfo_PrimaryIndex proto.InternalMessageInfo type SecondaryIndex struct { - TableID github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID `protobuf:"varint,1,opt,name=table_id,json=tableId,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ID" json:"table_id,omitempty"` - Index descpb.IndexDescriptor `protobuf:"bytes,2,opt,name=index,proto3" json:"index"` - PrimaryIndex github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.IndexID `protobuf:"varint,3,opt,name=primary_index,json=primaryIndex,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.IndexID" json:"primary_index,omitempty"` + TableID github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID `protobuf:"varint,1,opt,name=table_id,json=tableId,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ID" json:"table_id,omitempty"` + IndexId github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.IndexID `protobuf:"varint,2,opt,name=index_id,json=indexId,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.IndexID" json:"index_id,omitempty"` + IndexName string `protobuf:"bytes,3,opt,name=index_name,json=indexName,proto3" json:"index_name,omitempty"` + Unique bool `protobuf:"varint,4,opt,name=unique,proto3" json:"unique,omitempty"` + KeyColumnIDs []github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID `protobuf:"varint,5,rep,packed,name=key_column_ids,json=keyColumnIds,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID" json:"key_column_ids,omitempty"` + KeyColumnDirections []SecondaryIndex_Direction `protobuf:"varint,6,rep,packed,name=key_column_direction,json=keyColumnDirection,proto3,enum=cockroach.sql.schemachanger.scpb.SecondaryIndex_Direction" json:"key_column_direction,omitempty"` + KeySuffixColumnIDs []github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID `protobuf:"varint,7,rep,packed,name=key_suffix_column_ids,json=keySuffixColumnIds,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID" json:"key_suffix_column_ids,omitempty"` + ShardedDescriptor *descpb.ShardedDescriptor `protobuf:"bytes,8,opt,name=sharded_descriptor,json=shardedDescriptor,proto3" json:"sharded_descriptor,omitempty"` + StoringColumnIDs []github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID `protobuf:"varint,9,rep,packed,name=storing_column_ids,json=storingColumnIds,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID" json:"storing_column_ids,omitempty"` + CompositeColumnIDs []github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID `protobuf:"varint,10,rep,packed,name=composite_column_ids,json=compositeColumnIds,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID" json:"composite_column_ids,omitempty"` + Inverted bool `protobuf:"varint,11,opt,name=inverted,proto3" json:"inverted,omitempty"` + Concurrently bool `protobuf:"varint,12,opt,name=concurrently,proto3" json:"concurrently,omitempty"` } func (m *SecondaryIndex) Reset() { *m = SecondaryIndex{} } @@ -842,9 +913,118 @@ func (m *Database) XXX_DiscardUnknown() { var xxx_messageInfo_Database proto.InternalMessageInfo +// FIXME: Dead code +type ListPartition struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Expr []string `protobuf:"bytes,2,rep,name=expr,proto3" json:"expr,omitempty"` +} + +func (m *ListPartition) Reset() { *m = ListPartition{} } +func (m *ListPartition) String() string { return proto.CompactTextString(m) } +func (*ListPartition) ProtoMessage() {} +func (*ListPartition) Descriptor() ([]byte, []int) { + return fileDescriptor_5413c88842564e28, []int{20} +} +func (m *ListPartition) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ListPartition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ListPartition) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListPartition.Merge(m, src) +} +func (m *ListPartition) XXX_Size() int { + return m.Size() +} +func (m *ListPartition) XXX_DiscardUnknown() { + xxx_messageInfo_ListPartition.DiscardUnknown(m) +} + +var xxx_messageInfo_ListPartition proto.InternalMessageInfo + +type RangePartitions struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + To []string `protobuf:"bytes,2,rep,name=To,proto3" json:"To,omitempty"` + From []string `protobuf:"bytes,3,rep,name=From,proto3" json:"From,omitempty"` +} + +func (m *RangePartitions) Reset() { *m = RangePartitions{} } +func (m *RangePartitions) String() string { return proto.CompactTextString(m) } +func (*RangePartitions) ProtoMessage() {} +func (*RangePartitions) Descriptor() ([]byte, []int) { + return fileDescriptor_5413c88842564e28, []int{21} +} +func (m *RangePartitions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RangePartitions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *RangePartitions) XXX_Merge(src proto.Message) { + xxx_messageInfo_RangePartitions.Merge(m, src) +} +func (m *RangePartitions) XXX_Size() int { + return m.Size() +} +func (m *RangePartitions) XXX_DiscardUnknown() { + xxx_messageInfo_RangePartitions.DiscardUnknown(m) +} + +var xxx_messageInfo_RangePartitions proto.InternalMessageInfo + +type Partitioning struct { + TableID github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID `protobuf:"varint,1,opt,name=table_id,json=tableId,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ID" json:"table_id,omitempty"` + IndexId github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.IndexID `protobuf:"varint,2,opt,name=index_id,json=indexId,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.IndexID" json:"index_id,omitempty"` + Fields []string `protobuf:"bytes,3,rep,name=fields,proto3" json:"fields,omitempty"` + ListPartitions []*ListPartition `protobuf:"bytes,4,rep,name=list_partitions,json=listPartitions,proto3" json:"list_partitions,omitempty"` + RangePartitions []*RangePartitions `protobuf:"bytes,5,rep,name=range_partitions,json=rangePartitions,proto3" json:"range_partitions,omitempty"` +} + +func (m *Partitioning) Reset() { *m = Partitioning{} } +func (m *Partitioning) String() string { return proto.CompactTextString(m) } +func (*Partitioning) ProtoMessage() {} +func (*Partitioning) Descriptor() ([]byte, []int) { + return fileDescriptor_5413c88842564e28, []int{22} +} +func (m *Partitioning) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Partitioning) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Partitioning) XXX_Merge(src proto.Message) { + xxx_messageInfo_Partitioning.Merge(m, src) +} +func (m *Partitioning) XXX_Size() int { + return m.Size() +} +func (m *Partitioning) XXX_DiscardUnknown() { + xxx_messageInfo_Partitioning.DiscardUnknown(m) +} + +var xxx_messageInfo_Partitioning proto.InternalMessageInfo + func init() { proto.RegisterEnum("cockroach.sql.schemachanger.scpb.Status", Status_name, Status_value) proto.RegisterEnum("cockroach.sql.schemachanger.scpb.Target_Direction", Target_Direction_name, Target_Direction_value) + proto.RegisterEnum("cockroach.sql.schemachanger.scpb.PrimaryIndex_Direction", PrimaryIndex_Direction_name, PrimaryIndex_Direction_value) + proto.RegisterEnum("cockroach.sql.schemachanger.scpb.SecondaryIndex_Direction", SecondaryIndex_Direction_name, SecondaryIndex_Direction_value) proto.RegisterEnum("cockroach.sql.schemachanger.scpb.SequenceDependency_Type", SequenceDependency_Type_name, SequenceDependency_Type_value) proto.RegisterType((*ElementProto)(nil), "cockroach.sql.schemachanger.scpb.ElementProto") proto.RegisterType((*Target)(nil), "cockroach.sql.schemachanger.scpb.Target") @@ -866,119 +1046,150 @@ func init() { proto.RegisterType((*Type)(nil), "cockroach.sql.schemachanger.scpb.Type") proto.RegisterType((*Schema)(nil), "cockroach.sql.schemachanger.scpb.Schema") proto.RegisterType((*Database)(nil), "cockroach.sql.schemachanger.scpb.Database") + proto.RegisterType((*ListPartition)(nil), "cockroach.sql.schemachanger.scpb.ListPartition") + proto.RegisterType((*RangePartitions)(nil), "cockroach.sql.schemachanger.scpb.RangePartitions") + proto.RegisterType((*Partitioning)(nil), "cockroach.sql.schemachanger.scpb.Partitioning") } func init() { proto.RegisterFile("sql/schemachanger/scpb/scpb.proto", fileDescriptor_5413c88842564e28) } var fileDescriptor_5413c88842564e28 = []byte{ - // 1698 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 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41, 0x61, 0xe5, - 0x74, 0x5c, 0xe0, 0xce, 0xc6, 0x05, 0xee, 0xf5, 0xb8, 0xc0, 0xfd, 0x7f, 0x5c, 0xe0, 0xfe, 0xf6, - 0xa6, 0xb0, 0x72, 0xf6, 0xa6, 0xb0, 0xf2, 0xfa, 0x4d, 0x61, 0xe5, 0x09, 0x4f, 0xb4, 0xea, 0x24, - 0xe8, 0xbd, 0xfb, 0xbd, 0x2f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xc8, 0xdd, 0x27, 0xd1, 0xf6, 0x1d, - 0x00, 0x00, + // 2158 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5a, 0xcf, 0x6f, 0x23, 0x49, + 0xf5, 0x4f, 0x3b, 0x8e, 0x63, 0xbf, 0xf8, 0x47, 0xa7, 0x66, 0xe6, 0xfb, 0x35, 0xab, 0x51, 0x7a, + 0xd6, 0x48, 0xbb, 0xd1, 0x82, 0x1c, 0x98, 0x5d, 0x21, 0x88, 0x84, 0xd8, 0x38, 0xed, 0x88, 0x26, + 0x59, 0x3b, 0x5b, 0x76, 0x26, 0xbb, 0x23, 0xc0, 0xea, 0x74, 0x57, 0x9c, 0xde, 0xd8, 0xdd, 0x4e, + 0x77, 0x7b, 0x32, 0x06, 0x04, 0x07, 0x04, 0x27, 0x7e, 0x9d, 0x38, 0xf3, 0x37, 0x20, 0xf1, 0x2f, + 0xa0, 0x11, 0x5c, 0x86, 0x0b, 0x5a, 0x09, 0xc9, 0x40, 0x8f, 0x04, 0x5c, 0xe1, 0x80, 0xc4, 0x9e, + 0x50, 0x55, 0xf5, 0x4f, 0x7b, 0x20, 0xde, 0xb1, 0x27, 0x5a, 0x0d, 0x73, 0xb1, 0xba, 0x5f, 0xf5, + 0xfb, 0x7c, 0xaa, 0x5e, 0xd5, 0x7b, 0xaf, 0x5e, 0x95, 0xe1, 0x55, 0xe7, 0xa2, 0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7, 0x69, 0x40, + 0xd3, 0x27, 0xfb, 0xa8, 0x0b, 0x39, 0xcb, 0x36, 0xba, 0x86, 0x19, 0xf5, 0xe0, 0x6b, 0x34, 0xa6, + 0x34, 0x99, 0x70, 0xee, 0x3e, 0x64, 0x39, 0xb8, 0xa2, 0xa3, 0xef, 0x40, 0xd1, 0x27, 0xe2, 0x01, + 0x26, 0x08, 0x26, 0x47, 0xde, 0x58, 0x2a, 0x70, 0x36, 0x1e, 0x83, 0x16, 0x93, 0x57, 0x0a, 0x56, + 0x1c, 0x12, 0x0d, 0x20, 0x6f, 0x07, 0x53, 0x4c, 0x47, 0x9a, 0x66, 0x23, 0x7d, 0xc7, 0x1b, 0x4b, + 0x6b, 0xe1, 0xd4, 0xcf, 0x3d, 0xd8, 0xb5, 0x90, 0x42, 0xd1, 0x69, 0xf9, 0xb8, 0x1e, 0x51, 0x06, + 0x63, 0x5e, 0x89, 0xaa, 0x96, 0x90, 0x77, 0x91, 0xc3, 0x16, 0xed, 0x09, 0xd4, 0x30, 0xdf, 0x67, + 0xa2, 0x7c, 0x1f, 0xa4, 0xb2, 0x34, 0xac, 0x4f, 0x5d, 0xc8, 0xbc, 0x5c, 0x10, 0xff, 0xbb, 0x0b, + 0xe2, 0x9f, 0x02, 0x94, 0x26, 0xee, 0xb6, 0xae, 0x79, 0x93, 0x85, 0x5c, 0x28, 0x5a, 0x97, 0x26, + 0xb1, 0x3b, 0x61, 0xd6, 0x89, 0x0a, 0x80, 0x3c, 0xbb, 0x5e, 0x5b, 0x4c, 0xea, 0xc9, 0x5b, 0x11, + 0x96, 0x5e, 0xf9, 0x87, 0x00, 0x37, 0x9f, 0x76, 0x73, 0x78, 0x4d, 0xe9, 0xcf, 0x04, 0x88, 0x52, + 0x53, 0x7c, 0xc0, 0x0b, 0x4c, 0x7e, 0x31, 0x06, 0x7f, 0xb6, 0x0d, 0xbf, 0x1e, 0x7c, 0xfe, 0x19, + 0xa8, 0xf2, 0x77, 0x01, 0x32, 0xf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e, 0x7c, 0xb2, 0xb1, 0x74, 0x3f, 0x4d, 0x07, 0x7f, 0x92, 0x61, 0xff, 0x97, 0x78, 0xf3, + 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x7e, 0xa2, 0x2e, 0x02, 0x28, 0x00, 0x00, } func (this *Column) Equal(that interface{}) bool { @@ -1036,10 +1247,62 @@ func (this *PrimaryIndex) Equal(that interface{}) bool { if this.TableID != that1.TableID { return false } - if !this.Index.Equal(&that1.Index) { + if this.IndexId != that1.IndexId { + return false + } + if this.IndexName != that1.IndexName { + return false + } + if this.Unique != that1.Unique { + return false + } + if len(this.KeyColumnIDs) != len(that1.KeyColumnIDs) { + return false + } + for i := range this.KeyColumnIDs { + if this.KeyColumnIDs[i] != that1.KeyColumnIDs[i] { + return false + } + } + if len(this.KeyColumnDirections) != len(that1.KeyColumnDirections) { + return false + } + for i := range this.KeyColumnDirections { + if this.KeyColumnDirections[i] != that1.KeyColumnDirections[i] { + return false + } + } + if len(this.KeySuffixColumnIDs) != len(that1.KeySuffixColumnIDs) { + return false + } + for i := range this.KeySuffixColumnIDs { + if this.KeySuffixColumnIDs[i] != that1.KeySuffixColumnIDs[i] { + return false + } + } + if !this.ShardedDescriptor.Equal(that1.ShardedDescriptor) { + return false + } + if len(this.StoringColumnIDs) != len(that1.StoringColumnIDs) { + return false + } + for i := range this.StoringColumnIDs { + if this.StoringColumnIDs[i] != that1.StoringColumnIDs[i] { + return false + } + } + if len(this.CompositeColumnIDs) != len(that1.CompositeColumnIDs) { + return false + } + for i := range this.CompositeColumnIDs { + if this.CompositeColumnIDs[i] != that1.CompositeColumnIDs[i] { + return false + } + } + if this.Inverted != that1.Inverted { return false } - if this.OtherPrimaryIndexID != that1.OtherPrimaryIndexID { + if this.Concurrently != that1.Concurrently { return false } return true @@ -1066,10 +1329,62 @@ func (this *SecondaryIndex) Equal(that interface{}) bool { if this.TableID != that1.TableID { return false } - if !this.Index.Equal(&that1.Index) { + if this.IndexId != that1.IndexId { + return false + } + if this.IndexName != that1.IndexName { + return false + } + if this.Unique != that1.Unique { + return false + } + if len(this.KeyColumnIDs) != len(that1.KeyColumnIDs) { + return false + } + for i := range this.KeyColumnIDs { + if this.KeyColumnIDs[i] != that1.KeyColumnIDs[i] { + return false + } + } + if len(this.KeyColumnDirections) != len(that1.KeyColumnDirections) { + return false + } + for i := range this.KeyColumnDirections { + if this.KeyColumnDirections[i] != that1.KeyColumnDirections[i] { + return false + } + } + if len(this.KeySuffixColumnIDs) != len(that1.KeySuffixColumnIDs) { + return false + } + for i := range this.KeySuffixColumnIDs { + if this.KeySuffixColumnIDs[i] != that1.KeySuffixColumnIDs[i] { + return false + } + } + if !this.ShardedDescriptor.Equal(that1.ShardedDescriptor) { + return false + } + if len(this.StoringColumnIDs) != len(that1.StoringColumnIDs) { + return false + } + for i := range this.StoringColumnIDs { + if this.StoringColumnIDs[i] != that1.StoringColumnIDs[i] { + return false + } + } + if len(this.CompositeColumnIDs) != len(that1.CompositeColumnIDs) { + return false + } + for i := range this.CompositeColumnIDs { + if this.CompositeColumnIDs[i] != that1.CompositeColumnIDs[i] { + return false + } + } + if this.Inverted != that1.Inverted { return false } - if this.PrimaryIndex != that1.PrimaryIndex { + if this.Concurrently != that1.Concurrently { return false } return true @@ -1463,6 +1778,129 @@ func (this *RelationDependedOnBy) Equal(that interface{}) bool { } return true } +func (this *ListPartition) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ListPartition) + if !ok { + that2, ok := that.(ListPartition) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if len(this.Expr) != len(that1.Expr) { + return false + } + for i := range this.Expr { + if this.Expr[i] != that1.Expr[i] { + return false + } + } + return true +} +func (this *RangePartitions) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RangePartitions) + if !ok { + that2, ok := that.(RangePartitions) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if len(this.To) != len(that1.To) { + return false + } + for i := range this.To { + if this.To[i] != that1.To[i] { + return false + } + } + if len(this.From) != len(that1.From) { + return false + } + for i := range this.From { + if this.From[i] != that1.From[i] { + return false + } + } + return true +} +func (this *Partitioning) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Partitioning) + if !ok { + that2, ok := that.(Partitioning) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.TableID != that1.TableID { + return false + } + if this.IndexId != that1.IndexId { + return false + } + if len(this.Fields) != len(that1.Fields) { + return false + } + for i := range this.Fields { + if this.Fields[i] != that1.Fields[i] { + return false + } + } + if len(this.ListPartitions) != len(that1.ListPartitions) { + return false + } + for i := range this.ListPartitions { + if !this.ListPartitions[i].Equal(that1.ListPartitions[i]) { + return false + } + } + if len(this.RangePartitions) != len(that1.RangePartitions) { + return false + } + for i := range this.RangePartitions { + if !this.RangePartitions[i].Equal(that1.RangePartitions[i]) { + return false + } + } + return true +} func (m *ElementProto) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1483,6 +1921,20 @@ func (m *ElementProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Partitioning != nil { + { + size, err := m.Partitioning.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintScpb(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x9a + } if m.Database != nil { { size, err := m.Database.MarshalToSizedBuffer(dAtA[:i]) @@ -1816,21 +2268,150 @@ func (m *PrimaryIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.OtherPrimaryIndexID != 0 { - i = encodeVarintScpb(dAtA, i, uint64(m.OtherPrimaryIndexID)) + if m.Concurrently { i-- - dAtA[i] = 0x18 + if m.Concurrently { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x60 } - { - size, err := m.Index.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Inverted { + i-- + if m.Inverted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } - i -= size - i = encodeVarintScpb(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x58 + } + if len(m.CompositeColumnIDs) > 0 { + dAtA23 := make([]byte, len(m.CompositeColumnIDs)*10) + var j22 int + for _, num := range m.CompositeColumnIDs { + for num >= 1<<7 { + dAtA23[j22] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j22++ + } + dAtA23[j22] = uint8(num) + j22++ + } + i -= j22 + copy(dAtA[i:], dAtA23[:j22]) + i = encodeVarintScpb(dAtA, i, uint64(j22)) + i-- + dAtA[i] = 0x52 + } + if len(m.StoringColumnIDs) > 0 { + dAtA25 := make([]byte, len(m.StoringColumnIDs)*10) + var j24 int + for _, num := range m.StoringColumnIDs { + for num >= 1<<7 { + dAtA25[j24] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j24++ + } + dAtA25[j24] = uint8(num) + j24++ + } + i -= j24 + copy(dAtA[i:], dAtA25[:j24]) + i = encodeVarintScpb(dAtA, i, uint64(j24)) + i-- + dAtA[i] = 0x4a + } + if m.ShardedDescriptor != nil { + { + size, err := m.ShardedDescriptor.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintScpb(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + if len(m.KeySuffixColumnIDs) > 0 { + dAtA28 := make([]byte, len(m.KeySuffixColumnIDs)*10) + var j27 int + for _, num := range m.KeySuffixColumnIDs { + for num >= 1<<7 { + dAtA28[j27] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j27++ + } + dAtA28[j27] = uint8(num) + j27++ + } + i -= j27 + copy(dAtA[i:], dAtA28[:j27]) + i = encodeVarintScpb(dAtA, i, uint64(j27)) + i-- + dAtA[i] = 0x3a + } + if len(m.KeyColumnDirections) > 0 { + dAtA30 := make([]byte, len(m.KeyColumnDirections)*10) + var j29 int + for _, num := range m.KeyColumnDirections { + for num >= 1<<7 { + dAtA30[j29] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j29++ + } + dAtA30[j29] = uint8(num) + j29++ + } + i -= j29 + copy(dAtA[i:], dAtA30[:j29]) + i = encodeVarintScpb(dAtA, i, uint64(j29)) + i-- + dAtA[i] = 0x32 + } + if len(m.KeyColumnIDs) > 0 { + dAtA32 := make([]byte, len(m.KeyColumnIDs)*10) + var j31 int + for _, num := range m.KeyColumnIDs { + for num >= 1<<7 { + dAtA32[j31] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j31++ + } + dAtA32[j31] = uint8(num) + j31++ + } + i -= j31 + copy(dAtA[i:], dAtA32[:j31]) + i = encodeVarintScpb(dAtA, i, uint64(j31)) + i-- + dAtA[i] = 0x2a + } + if m.Unique { + i-- + if m.Unique { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.IndexName) > 0 { + i -= len(m.IndexName) + copy(dAtA[i:], m.IndexName) + i = encodeVarintScpb(dAtA, i, uint64(len(m.IndexName))) + i-- + dAtA[i] = 0x1a + } + if m.IndexId != 0 { + i = encodeVarintScpb(dAtA, i, uint64(m.IndexId)) + i-- + dAtA[i] = 0x10 } - i-- - dAtA[i] = 0x12 if m.TableID != 0 { i = encodeVarintScpb(dAtA, i, uint64(m.TableID)) i-- @@ -1859,21 +2440,150 @@ func (m *SecondaryIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.PrimaryIndex != 0 { - i = encodeVarintScpb(dAtA, i, uint64(m.PrimaryIndex)) + if m.Concurrently { i-- - dAtA[i] = 0x18 + if m.Concurrently { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x60 } - { - size, err := m.Index.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Inverted { + i-- + if m.Inverted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } - i -= size - i = encodeVarintScpb(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x58 + } + if len(m.CompositeColumnIDs) > 0 { + dAtA34 := make([]byte, len(m.CompositeColumnIDs)*10) + var j33 int + for _, num := range m.CompositeColumnIDs { + for num >= 1<<7 { + dAtA34[j33] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j33++ + } + dAtA34[j33] = uint8(num) + j33++ + } + i -= j33 + copy(dAtA[i:], dAtA34[:j33]) + i = encodeVarintScpb(dAtA, i, uint64(j33)) + i-- + dAtA[i] = 0x52 + } + if len(m.StoringColumnIDs) > 0 { + dAtA36 := make([]byte, len(m.StoringColumnIDs)*10) + var j35 int + for _, num := range m.StoringColumnIDs { + for num >= 1<<7 { + dAtA36[j35] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j35++ + } + dAtA36[j35] = uint8(num) + j35++ + } + i -= j35 + copy(dAtA[i:], dAtA36[:j35]) + i = encodeVarintScpb(dAtA, i, uint64(j35)) + i-- + dAtA[i] = 0x4a + } + if m.ShardedDescriptor != nil { + { + size, err := m.ShardedDescriptor.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintScpb(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + if len(m.KeySuffixColumnIDs) > 0 { + dAtA39 := make([]byte, len(m.KeySuffixColumnIDs)*10) + var j38 int + for _, num := range m.KeySuffixColumnIDs { + for num >= 1<<7 { + dAtA39[j38] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j38++ + } + dAtA39[j38] = uint8(num) + j38++ + } + i -= j38 + copy(dAtA[i:], dAtA39[:j38]) + i = encodeVarintScpb(dAtA, i, uint64(j38)) + i-- + dAtA[i] = 0x3a + } + if len(m.KeyColumnDirections) > 0 { + dAtA41 := make([]byte, len(m.KeyColumnDirections)*10) + var j40 int + for _, num := range m.KeyColumnDirections { + for num >= 1<<7 { + dAtA41[j40] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j40++ + } + dAtA41[j40] = uint8(num) + j40++ + } + i -= j40 + copy(dAtA[i:], dAtA41[:j40]) + i = encodeVarintScpb(dAtA, i, uint64(j40)) + i-- + dAtA[i] = 0x32 + } + if len(m.KeyColumnIDs) > 0 { + dAtA43 := make([]byte, len(m.KeyColumnIDs)*10) + var j42 int + for _, num := range m.KeyColumnIDs { + for num >= 1<<7 { + dAtA43[j42] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j42++ + } + dAtA43[j42] = uint8(num) + j42++ + } + i -= j42 + copy(dAtA[i:], dAtA43[:j42]) + i = encodeVarintScpb(dAtA, i, uint64(j42)) + i-- + dAtA[i] = 0x2a + } + if m.Unique { + i-- + if m.Unique { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.IndexName) > 0 { + i -= len(m.IndexName) + copy(dAtA[i:], m.IndexName) + i = encodeVarintScpb(dAtA, i, uint64(len(m.IndexName))) + i-- + dAtA[i] = 0x1a + } + if m.IndexId != 0 { + i = encodeVarintScpb(dAtA, i, uint64(m.IndexId)) + i-- + dAtA[i] = 0x10 } - i-- - dAtA[i] = 0x12 if m.TableID != 0 { i = encodeVarintScpb(dAtA, i, uint64(m.TableID)) i-- @@ -1946,20 +2656,20 @@ func (m *UniqueConstraint) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.ColumnIDs) > 0 { - dAtA24 := make([]byte, len(m.ColumnIDs)*10) - var j23 int + dAtA45 := make([]byte, len(m.ColumnIDs)*10) + var j44 int for _, num := range m.ColumnIDs { for num >= 1<<7 { - dAtA24[j23] = uint8(uint64(num)&0x7f | 0x80) + dAtA45[j44] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j23++ + j44++ } - dAtA24[j23] = uint8(num) - j23++ + dAtA45[j44] = uint8(num) + j44++ } - i -= j23 - copy(dAtA[i:], dAtA24[:j23]) - i = encodeVarintScpb(dAtA, i, uint64(j23)) + i -= j44 + copy(dAtA[i:], dAtA45[:j44]) + i = encodeVarintScpb(dAtA, i, uint64(j44)) i-- dAtA[i] = 0x1a } @@ -2007,20 +2717,20 @@ func (m *CheckConstraint) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x28 } if len(m.ColumnIDs) > 0 { - dAtA26 := make([]byte, len(m.ColumnIDs)*10) - var j25 int + dAtA47 := make([]byte, len(m.ColumnIDs)*10) + var j46 int for _, num := range m.ColumnIDs { for num >= 1<<7 { - dAtA26[j25] = uint8(uint64(num)&0x7f | 0x80) + dAtA47[j46] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j25++ + j46++ } - dAtA26[j25] = uint8(num) - j25++ + dAtA47[j46] = uint8(num) + j46++ } - i -= j25 - copy(dAtA[i:], dAtA26[:j25]) - i = encodeVarintScpb(dAtA, i, uint64(j25)) + i -= j46 + copy(dAtA[i:], dAtA47[:j46]) + i = encodeVarintScpb(dAtA, i, uint64(j46)) i-- dAtA[i] = 0x22 } @@ -2102,20 +2812,20 @@ func (m *DefaultExpression) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } if len(m.UsesSequenceIDs) > 0 { - dAtA28 := make([]byte, len(m.UsesSequenceIDs)*10) - var j27 int + dAtA49 := make([]byte, len(m.UsesSequenceIDs)*10) + var j48 int for _, num := range m.UsesSequenceIDs { for num >= 1<<7 { - dAtA28[j27] = uint8(uint64(num)&0x7f | 0x80) + dAtA49[j48] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j27++ + j48++ } - dAtA28[j27] = uint8(num) - j27++ + dAtA49[j48] = uint8(num) + j48++ } - i -= j27 - copy(dAtA[i:], dAtA28[:j27]) - i = encodeVarintScpb(dAtA, i, uint64(j27)) + i -= j48 + copy(dAtA[i:], dAtA49[:j48]) + i = encodeVarintScpb(dAtA, i, uint64(j48)) i-- dAtA[i] = 0x1a } @@ -2153,38 +2863,38 @@ func (m *View) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.DependsOn) > 0 { - dAtA30 := make([]byte, len(m.DependsOn)*10) - var j29 int + dAtA51 := make([]byte, len(m.DependsOn)*10) + var j50 int for _, num := range m.DependsOn { for num >= 1<<7 { - dAtA30[j29] = uint8(uint64(num)&0x7f | 0x80) + dAtA51[j50] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j29++ + j50++ } - dAtA30[j29] = uint8(num) - j29++ + dAtA51[j50] = uint8(num) + j50++ } - i -= j29 - copy(dAtA[i:], dAtA30[:j29]) - i = encodeVarintScpb(dAtA, i, uint64(j29)) + i -= j50 + copy(dAtA[i:], dAtA51[:j50]) + i = encodeVarintScpb(dAtA, i, uint64(j50)) i-- dAtA[i] = 0x1a } if len(m.DependedOnBy) > 0 { - dAtA32 := make([]byte, len(m.DependedOnBy)*10) - var j31 int + dAtA53 := make([]byte, len(m.DependedOnBy)*10) + var j52 int for _, num := range m.DependedOnBy { for num >= 1<<7 { - dAtA32[j31] = uint8(uint64(num)&0x7f | 0x80) + dAtA53[j52] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j31++ + j52++ } - dAtA32[j31] = uint8(num) - j31++ + dAtA53[j52] = uint8(num) + j52++ } - i -= j31 - copy(dAtA[i:], dAtA32[:j31]) - i = encodeVarintScpb(dAtA, i, uint64(j31)) + i -= j52 + copy(dAtA[i:], dAtA53[:j52]) + i = encodeVarintScpb(dAtA, i, uint64(j52)) i-- dAtA[i] = 0x12 } @@ -2217,20 +2927,20 @@ func (m *Table) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.DependedOnBy) > 0 { - dAtA34 := make([]byte, len(m.DependedOnBy)*10) - var j33 int + dAtA55 := make([]byte, len(m.DependedOnBy)*10) + var j54 int for _, num := range m.DependedOnBy { for num >= 1<<7 { - dAtA34[j33] = uint8(uint64(num)&0x7f | 0x80) + dAtA55[j54] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j33++ + j54++ } - dAtA34[j33] = uint8(num) - j33++ + dAtA55[j54] = uint8(num) + j54++ } - i -= j33 - copy(dAtA[i:], dAtA34[:j33]) - i = encodeVarintScpb(dAtA, i, uint64(j33)) + i -= j54 + copy(dAtA[i:], dAtA55[:j54]) + i = encodeVarintScpb(dAtA, i, uint64(j54)) i-- dAtA[i] = 0x12 } @@ -2303,20 +3013,20 @@ func (m *OutboundForeignKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x32 } if len(m.ReferenceColumns) > 0 { - dAtA36 := make([]byte, len(m.ReferenceColumns)*10) - var j35 int + dAtA57 := make([]byte, len(m.ReferenceColumns)*10) + var j56 int for _, num := range m.ReferenceColumns { for num >= 1<<7 { - dAtA36[j35] = uint8(uint64(num)&0x7f | 0x80) + dAtA57[j56] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j35++ + j56++ } - dAtA36[j35] = uint8(num) - j35++ + dAtA57[j56] = uint8(num) + j56++ } - i -= j35 - copy(dAtA[i:], dAtA36[:j35]) - i = encodeVarintScpb(dAtA, i, uint64(j35)) + i -= j56 + copy(dAtA[i:], dAtA57[:j56]) + i = encodeVarintScpb(dAtA, i, uint64(j56)) i-- dAtA[i] = 0x2a } @@ -2326,20 +3036,20 @@ func (m *OutboundForeignKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x20 } if len(m.OriginColumns) > 0 { - dAtA38 := make([]byte, len(m.OriginColumns)*10) - var j37 int + dAtA59 := make([]byte, len(m.OriginColumns)*10) + var j58 int for _, num := range m.OriginColumns { for num >= 1<<7 { - dAtA38[j37] = uint8(uint64(num)&0x7f | 0x80) + dAtA59[j58] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j37++ + j58++ } - dAtA38[j37] = uint8(num) - j37++ + dAtA59[j58] = uint8(num) + j58++ } - i -= j37 - copy(dAtA[i:], dAtA38[:j37]) - i = encodeVarintScpb(dAtA, i, uint64(j37)) + i -= j58 + copy(dAtA[i:], dAtA59[:j58]) + i = encodeVarintScpb(dAtA, i, uint64(j58)) i-- dAtA[i] = 0x1a } @@ -2379,20 +3089,20 @@ func (m *InboundForeignKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x32 } if len(m.ReferenceColumns) > 0 { - dAtA40 := make([]byte, len(m.ReferenceColumns)*10) - var j39 int + dAtA61 := make([]byte, len(m.ReferenceColumns)*10) + var j60 int for _, num := range m.ReferenceColumns { for num >= 1<<7 { - dAtA40[j39] = uint8(uint64(num)&0x7f | 0x80) + dAtA61[j60] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j39++ + j60++ } - dAtA40[j39] = uint8(num) - j39++ + dAtA61[j60] = uint8(num) + j60++ } - i -= j39 - copy(dAtA[i:], dAtA40[:j39]) - i = encodeVarintScpb(dAtA, i, uint64(j39)) + i -= j60 + copy(dAtA[i:], dAtA61[:j60]) + i = encodeVarintScpb(dAtA, i, uint64(j60)) i-- dAtA[i] = 0x2a } @@ -2402,20 +3112,20 @@ func (m *InboundForeignKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x20 } if len(m.OriginColumns) > 0 { - dAtA42 := make([]byte, len(m.OriginColumns)*10) - var j41 int + dAtA63 := make([]byte, len(m.OriginColumns)*10) + var j62 int for _, num := range m.OriginColumns { for num >= 1<<7 { - dAtA42[j41] = uint8(uint64(num)&0x7f | 0x80) + dAtA63[j62] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j41++ + j62++ } - dAtA42[j41] = uint8(num) - j41++ + dAtA63[j62] = uint8(num) + j62++ } - i -= j41 - copy(dAtA[i:], dAtA42[:j41]) - i = encodeVarintScpb(dAtA, i, uint64(j41)) + i -= j62 + copy(dAtA[i:], dAtA63[:j62]) + i = encodeVarintScpb(dAtA, i, uint64(j62)) i-- dAtA[i] = 0x1a } @@ -2542,20 +3252,20 @@ func (m *Schema) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.DependentObjects) > 0 { - dAtA44 := make([]byte, len(m.DependentObjects)*10) - var j43 int + dAtA65 := make([]byte, len(m.DependentObjects)*10) + var j64 int for _, num := range m.DependentObjects { for num >= 1<<7 { - dAtA44[j43] = uint8(uint64(num)&0x7f | 0x80) + dAtA65[j64] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j43++ + j64++ } - dAtA44[j43] = uint8(num) - j43++ + dAtA65[j64] = uint8(num) + j64++ } - i -= j43 - copy(dAtA[i:], dAtA44[:j43]) - i = encodeVarintScpb(dAtA, i, uint64(j43)) + i -= j64 + copy(dAtA[i:], dAtA65[:j64]) + i = encodeVarintScpb(dAtA, i, uint64(j64)) i-- dAtA[i] = 0x12 } @@ -2588,20 +3298,20 @@ func (m *Database) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.DependentObjects) > 0 { - dAtA46 := make([]byte, len(m.DependentObjects)*10) - var j45 int + dAtA67 := make([]byte, len(m.DependentObjects)*10) + var j66 int for _, num := range m.DependentObjects { for num >= 1<<7 { - dAtA46[j45] = uint8(uint64(num)&0x7f | 0x80) + dAtA67[j66] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j45++ + j66++ } - dAtA46[j45] = uint8(num) - j45++ + dAtA67[j66] = uint8(num) + j66++ } - i -= j45 - copy(dAtA[i:], dAtA46[:j45]) - i = encodeVarintScpb(dAtA, i, uint64(j45)) + i -= j66 + copy(dAtA[i:], dAtA67[:j66]) + i = encodeVarintScpb(dAtA, i, uint64(j66)) i-- dAtA[i] = 0x12 } @@ -2613,27 +3323,184 @@ func (m *Database) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintScpb(dAtA []byte, offset int, v uint64) int { - offset -= sovScpb(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *ListPartition) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *ElementProto) Size() (n int) { - if m == nil { - return 0 - } + +func (m *ListPartition) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ListPartition) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Column != nil { - l = m.Column.Size() - n += 1 + l + sovScpb(uint64(l)) - } + if len(m.Expr) > 0 { + for iNdEx := len(m.Expr) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Expr[iNdEx]) + copy(dAtA[i:], m.Expr[iNdEx]) + i = encodeVarintScpb(dAtA, i, uint64(len(m.Expr[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintScpb(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RangePartitions) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RangePartitions) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RangePartitions) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.From) > 0 { + for iNdEx := len(m.From) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.From[iNdEx]) + copy(dAtA[i:], m.From[iNdEx]) + i = encodeVarintScpb(dAtA, i, uint64(len(m.From[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.To) > 0 { + for iNdEx := len(m.To) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.To[iNdEx]) + copy(dAtA[i:], m.To[iNdEx]) + i = encodeVarintScpb(dAtA, i, uint64(len(m.To[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintScpb(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Partitioning) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Partitioning) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Partitioning) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RangePartitions) > 0 { + for iNdEx := len(m.RangePartitions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RangePartitions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintScpb(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.ListPartitions) > 0 { + for iNdEx := len(m.ListPartitions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ListPartitions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintScpb(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Fields) > 0 { + for iNdEx := len(m.Fields) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Fields[iNdEx]) + copy(dAtA[i:], m.Fields[iNdEx]) + i = encodeVarintScpb(dAtA, i, uint64(len(m.Fields[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if m.IndexId != 0 { + i = encodeVarintScpb(dAtA, i, uint64(m.IndexId)) + i-- + dAtA[i] = 0x10 + } + if m.TableID != 0 { + i = encodeVarintScpb(dAtA, i, uint64(m.TableID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintScpb(dAtA []byte, offset int, v uint64) int { + offset -= sovScpb(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ElementProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Column != nil { + l = m.Column.Size() + n += 1 + l + sovScpb(uint64(l)) + } if m.PrimaryIndex != nil { l = m.PrimaryIndex.Size() n += 1 + l + sovScpb(uint64(l)) @@ -2702,6 +3569,10 @@ func (m *ElementProto) Size() (n int) { l = m.Database.Size() n += 2 + l + sovScpb(uint64(l)) } + if m.Partitioning != nil { + l = m.Partitioning.Size() + n += 2 + l + sovScpb(uint64(l)) + } return n } @@ -2749,10 +3620,60 @@ func (m *PrimaryIndex) Size() (n int) { if m.TableID != 0 { n += 1 + sovScpb(uint64(m.TableID)) } - l = m.Index.Size() - n += 1 + l + sovScpb(uint64(l)) - if m.OtherPrimaryIndexID != 0 { - n += 1 + sovScpb(uint64(m.OtherPrimaryIndexID)) + if m.IndexId != 0 { + n += 1 + sovScpb(uint64(m.IndexId)) + } + l = len(m.IndexName) + if l > 0 { + n += 1 + l + sovScpb(uint64(l)) + } + if m.Unique { + n += 2 + } + if len(m.KeyColumnIDs) > 0 { + l = 0 + for _, e := range m.KeyColumnIDs { + l += sovScpb(uint64(e)) + } + n += 1 + sovScpb(uint64(l)) + l + } + if len(m.KeyColumnDirections) > 0 { + l = 0 + for _, e := range m.KeyColumnDirections { + l += sovScpb(uint64(e)) + } + n += 1 + sovScpb(uint64(l)) + l + } + if len(m.KeySuffixColumnIDs) > 0 { + l = 0 + for _, e := range m.KeySuffixColumnIDs { + l += sovScpb(uint64(e)) + } + n += 1 + sovScpb(uint64(l)) + l + } + if m.ShardedDescriptor != nil { + l = m.ShardedDescriptor.Size() + n += 1 + l + sovScpb(uint64(l)) + } + if len(m.StoringColumnIDs) > 0 { + l = 0 + for _, e := range m.StoringColumnIDs { + l += sovScpb(uint64(e)) + } + n += 1 + sovScpb(uint64(l)) + l + } + if len(m.CompositeColumnIDs) > 0 { + l = 0 + for _, e := range m.CompositeColumnIDs { + l += sovScpb(uint64(e)) + } + n += 1 + sovScpb(uint64(l)) + l + } + if m.Inverted { + n += 2 + } + if m.Concurrently { + n += 2 } return n } @@ -2766,10 +3687,60 @@ func (m *SecondaryIndex) Size() (n int) { if m.TableID != 0 { n += 1 + sovScpb(uint64(m.TableID)) } - l = m.Index.Size() - n += 1 + l + sovScpb(uint64(l)) - if m.PrimaryIndex != 0 { - n += 1 + sovScpb(uint64(m.PrimaryIndex)) + if m.IndexId != 0 { + n += 1 + sovScpb(uint64(m.IndexId)) + } + l = len(m.IndexName) + if l > 0 { + n += 1 + l + sovScpb(uint64(l)) + } + if m.Unique { + n += 2 + } + if len(m.KeyColumnIDs) > 0 { + l = 0 + for _, e := range m.KeyColumnIDs { + l += sovScpb(uint64(e)) + } + n += 1 + sovScpb(uint64(l)) + l + } + if len(m.KeyColumnDirections) > 0 { + l = 0 + for _, e := range m.KeyColumnDirections { + l += sovScpb(uint64(e)) + } + n += 1 + sovScpb(uint64(l)) + l + } + if len(m.KeySuffixColumnIDs) > 0 { + l = 0 + for _, e := range m.KeySuffixColumnIDs { + l += sovScpb(uint64(e)) + } + n += 1 + sovScpb(uint64(l)) + l + } + if m.ShardedDescriptor != nil { + l = m.ShardedDescriptor.Size() + n += 1 + l + sovScpb(uint64(l)) + } + if len(m.StoringColumnIDs) > 0 { + l = 0 + for _, e := range m.StoringColumnIDs { + l += sovScpb(uint64(e)) + } + n += 1 + sovScpb(uint64(l)) + l + } + if len(m.CompositeColumnIDs) > 0 { + l = 0 + for _, e := range m.CompositeColumnIDs { + l += sovScpb(uint64(e)) + } + n += 1 + sovScpb(uint64(l)) + l + } + if m.Inverted { + n += 2 + } + if m.Concurrently { + n += 2 } return n } @@ -3091,6 +4062,83 @@ func (m *Database) Size() (n int) { return n } +func (m *ListPartition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovScpb(uint64(l)) + } + if len(m.Expr) > 0 { + for _, s := range m.Expr { + l = len(s) + n += 1 + l + sovScpb(uint64(l)) + } + } + return n +} + +func (m *RangePartitions) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovScpb(uint64(l)) + } + if len(m.To) > 0 { + for _, s := range m.To { + l = len(s) + n += 1 + l + sovScpb(uint64(l)) + } + } + if len(m.From) > 0 { + for _, s := range m.From { + l = len(s) + n += 1 + l + sovScpb(uint64(l)) + } + } + return n +} + +func (m *Partitioning) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TableID != 0 { + n += 1 + sovScpb(uint64(m.TableID)) + } + if m.IndexId != 0 { + n += 1 + sovScpb(uint64(m.IndexId)) + } + if len(m.Fields) > 0 { + for _, s := range m.Fields { + l = len(s) + n += 1 + l + sovScpb(uint64(l)) + } + } + if len(m.ListPartitions) > 0 { + for _, e := range m.ListPartitions { + l = e.Size() + n += 1 + l + sovScpb(uint64(l)) + } + } + if len(m.RangePartitions) > 0 { + for _, e := range m.RangePartitions { + l = e.Size() + n += 1 + l + sovScpb(uint64(l)) + } + } + return n +} + func sovScpb(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3152,6 +4200,9 @@ func (this *ElementProto) GetValue() interface{} { if this.Database != nil { return this.Database } + if this.Partitioning != nil { + return this.Partitioning + } return nil } @@ -3193,6 +4244,8 @@ func (this *ElementProto) SetValue(value interface{}) bool { this.Schema = vt case *Database: this.Database = vt + case *Partitioning: + this.Partitioning = vt default: return false } @@ -3875,19 +4928,55 @@ func (m *ElementProto) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipScpb(dAtA[iNdEx:]) - if err != nil { - return err + case 19: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Partitioning", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthScpb + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + if msglen < 0 { + return ErrInvalidLengthScpb } - iNdEx += skippy + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Partitioning == nil { + m.Partitioning = &Partitioning{} + } + if err := m.Partitioning.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } @@ -4200,112 +5289,10 @@ func (m *PrimaryIndex) Unmarshal(dAtA []byte) error { } } case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthScpb - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthScpb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Index.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OtherPrimaryIndexID", wireType) - } - m.OtherPrimaryIndexID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.OtherPrimaryIndexID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.IndexID(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipScpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthScpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SecondaryIndex) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SecondaryIndex: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SecondaryIndex: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IndexId", wireType) } - m.TableID = 0 + m.IndexId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -4315,16 +5302,16 @@ func (m *SecondaryIndex) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + m.IndexId |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.IndexID(b&0x7F) << shift if b < 0x80 { break } } - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IndexName", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -4334,30 +5321,29 @@ func (m *SecondaryIndex) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthScpb } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthScpb } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Index.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.IndexName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PrimaryIndex", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Unique", wireType) } - m.PrimaryIndex = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -4367,226 +5353,158 @@ func (m *SecondaryIndex) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.PrimaryIndex |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.IndexID(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - default: - iNdEx = preIndex - skippy, err := skipScpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthScpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SequenceDependency) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SequenceDependency: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SequenceDependency: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) - } - m.TableID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb + m.Unique = bool(v != 0) + case 5: + if wireType == 0 { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { - return io.ErrUnexpectedEOF + m.KeyColumnIDs = append(m.KeyColumnIDs, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - b := dAtA[iNdEx] - iNdEx++ - m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift - if b < 0x80 { - break + if packedLen < 0 { + return ErrInvalidLengthScpb } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ColumnID", wireType) - } - m.ColumnID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthScpb } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - m.ColumnID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SequenceID", wireType) - } - m.SequenceID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } } - if iNdEx >= l { - return io.ErrUnexpectedEOF + elementCount = count + if elementCount != 0 && len(m.KeyColumnIDs) == 0 { + m.KeyColumnIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) } - b := dAtA[iNdEx] - iNdEx++ - m.SequenceID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift - if b < 0x80 { - break + for iNdEx < postIndex { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.KeyColumnIDs = append(m.KeyColumnIDs, v) } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field KeyColumnIDs", wireType) } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb + case 6: + if wireType == 0 { + var v PrimaryIndex_Direction + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= PrimaryIndex_Direction(b&0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { - return io.ErrUnexpectedEOF + m.KeyColumnDirections = append(m.KeyColumnDirections, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= SequenceDependency_Type(b&0x7F) << shift - if b < 0x80 { - break + if packedLen < 0 { + return ErrInvalidLengthScpb } - } - default: - iNdEx = preIndex - skippy, err := skipScpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthScpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UniqueConstraint) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UniqueConstraint: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UniqueConstraint: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) - } - m.TableID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthScpb } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IndexID", wireType) - } - m.IndexID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF + var elementCount int + if elementCount != 0 && len(m.KeyColumnDirections) == 0 { + m.KeyColumnDirections = make([]PrimaryIndex_Direction, 0, elementCount) } - b := dAtA[iNdEx] - iNdEx++ - m.IndexID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.IndexID(b&0x7F) << shift - if b < 0x80 { - break + for iNdEx < postIndex { + var v PrimaryIndex_Direction + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= PrimaryIndex_Direction(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.KeyColumnDirections = append(m.KeyColumnDirections, v) } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field KeyColumnDirections", wireType) } - case 3: + case 7: if wireType == 0 { var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID for shift := uint(0); ; shift += 7 { @@ -4603,7 +5521,7 @@ func (m *UniqueConstraint) Unmarshal(dAtA []byte) error { break } } - m.ColumnIDs = append(m.ColumnIDs, v) + m.KeySuffixColumnIDs = append(m.KeySuffixColumnIDs, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -4638,8 +5556,8 @@ func (m *UniqueConstraint) Unmarshal(dAtA []byte) error { } } elementCount = count - if elementCount != 0 && len(m.ColumnIDs) == 0 { - m.ColumnIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) + if elementCount != 0 && len(m.KeySuffixColumnIDs) == 0 { + m.KeySuffixColumnIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) } for iNdEx < postIndex { var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID @@ -4657,145 +5575,124 @@ func (m *UniqueConstraint) Unmarshal(dAtA []byte) error { break } } - m.ColumnIDs = append(m.ColumnIDs, v) + m.KeySuffixColumnIDs = append(m.KeySuffixColumnIDs, v) } } else { - return fmt.Errorf("proto: wrong wireType = %d for field ColumnIDs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field KeySuffixColumnIDs", wireType) } - default: - iNdEx = preIndex - skippy, err := skipScpb(dAtA[iNdEx:]) - if err != nil { - return err + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ShardedDescriptor", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthScpb + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + if msglen < 0 { + return ErrInvalidLengthScpb } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CheckConstraint) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthScpb } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + if m.ShardedDescriptor == nil { + m.ShardedDescriptor = &descpb.ShardedDescriptor{} } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CheckConstraint: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CheckConstraint: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) + if err := m.ShardedDescriptor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.TableID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb + iNdEx = postIndex + case 9: + if wireType == 0 { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { - return io.ErrUnexpectedEOF + m.StoringColumnIDs = append(m.StoringColumnIDs, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - b := dAtA[iNdEx] - iNdEx++ - m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift - if b < 0x80 { - break + if packedLen < 0 { + return ErrInvalidLengthScpb } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthScpb } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthScpb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthScpb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Expr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } } - if iNdEx >= l { - return io.ErrUnexpectedEOF + elementCount = count + if elementCount != 0 && len(m.StoringColumnIDs) == 0 { + m.StoringColumnIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break + for iNdEx < postIndex { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.StoringColumnIDs = append(m.StoringColumnIDs, v) } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field StoringColumnIDs", wireType) } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthScpb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthScpb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Expr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: + case 10: if wireType == 0 { var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID for shift := uint(0); ; shift += 7 { @@ -4812,7 +5709,7 @@ func (m *CheckConstraint) Unmarshal(dAtA []byte) error { break } } - m.ColumnIDs = append(m.ColumnIDs, v) + m.CompositeColumnIDs = append(m.CompositeColumnIDs, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -4847,8 +5744,8 @@ func (m *CheckConstraint) Unmarshal(dAtA []byte) error { } } elementCount = count - if elementCount != 0 && len(m.ColumnIDs) == 0 { - m.ColumnIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) + if elementCount != 0 && len(m.CompositeColumnIDs) == 0 { + m.CompositeColumnIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) } for iNdEx < postIndex { var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID @@ -4866,14 +5763,14 @@ func (m *CheckConstraint) Unmarshal(dAtA []byte) error { break } } - m.ColumnIDs = append(m.ColumnIDs, v) + m.CompositeColumnIDs = append(m.CompositeColumnIDs, v) } } else { - return fmt.Errorf("proto: wrong wireType = %d for field ColumnIDs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CompositeColumnIDs", wireType) } - case 5: + case 11: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Validated", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Inverted", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -4890,62 +5787,12 @@ func (m *CheckConstraint) Unmarshal(dAtA []byte) error { break } } - m.Validated = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipScpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthScpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Sequence) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Sequence: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Sequence: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + m.Inverted = bool(v != 0) + case 12: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SequenceID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Concurrently", wireType) } - m.SequenceID = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -4955,11 +5802,12 @@ func (m *Sequence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.SequenceID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } + m.Concurrently = bool(v != 0) default: iNdEx = preIndex skippy, err := skipScpb(dAtA[iNdEx:]) @@ -4981,7 +5829,7 @@ func (m *Sequence) Unmarshal(dAtA []byte) error { } return nil } -func (m *DefaultExpression) Unmarshal(dAtA []byte) error { +func (m *SecondaryIndex) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5004,10 +5852,10 @@ func (m *DefaultExpression) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DefaultExpression: wiretype end group for non-group") + return fmt.Errorf("proto: SecondaryIndex: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DefaultExpression: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: SecondaryIndex: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -5031,9 +5879,9 @@ func (m *DefaultExpression) Unmarshal(dAtA []byte) error { } case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ColumnID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IndexId", wireType) } - m.ColumnID = 0 + m.IndexId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -5043,95 +5891,19 @@ func (m *DefaultExpression) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ColumnID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + m.IndexId |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.IndexID(b&0x7F) << shift if b < 0x80 { break } } case 3: - if wireType == 0 { - var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.UsesSequenceIDs = append(m.UsesSequenceIDs, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthScpb - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthScpb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.UsesSequenceIDs) == 0 { - m.UsesSequenceIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID, 0, elementCount) - } - for iNdEx < postIndex { - var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.UsesSequenceIDs = append(m.UsesSequenceIDs, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field UsesSequenceIDs", wireType) - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DefaultExpr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IndexName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -5154,63 +5926,13 @@ func (m *DefaultExpression) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DefaultExpr = string(dAtA[iNdEx:postIndex]) + m.IndexName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipScpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthScpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *View) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: View: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: View: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Unique", wireType) } - m.TableID = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -5220,14 +5942,15 @@ func (m *View) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - case 2: + m.Unique = bool(v != 0) + case 5: if wireType == 0 { - var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -5237,12 +5960,12 @@ func (m *View) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift if b < 0x80 { break } } - m.DependedOnBy = append(m.DependedOnBy, v) + m.KeyColumnIDs = append(m.KeyColumnIDs, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -5277,11 +6000,11 @@ func (m *View) Unmarshal(dAtA []byte) error { } } elementCount = count - if elementCount != 0 && len(m.DependedOnBy) == 0 { - m.DependedOnBy = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID, 0, elementCount) + if elementCount != 0 && len(m.KeyColumnIDs) == 0 { + m.KeyColumnIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) } for iNdEx < postIndex { - var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -5291,19 +6014,19 @@ func (m *View) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift if b < 0x80 { break } } - m.DependedOnBy = append(m.DependedOnBy, v) + m.KeyColumnIDs = append(m.KeyColumnIDs, v) } } else { - return fmt.Errorf("proto: wrong wireType = %d for field DependedOnBy", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field KeyColumnIDs", wireType) } - case 3: + case 6: if wireType == 0 { - var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + var v SecondaryIndex_Direction for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -5313,12 +6036,12 @@ func (m *View) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + v |= SecondaryIndex_Direction(b&0x7F) << shift if b < 0x80 { break } } - m.DependsOn = append(m.DependsOn, v) + m.KeyColumnDirections = append(m.KeyColumnDirections, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -5346,18 +6069,11 @@ func (m *View) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.DependsOn) == 0 { - m.DependsOn = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID, 0, elementCount) + if elementCount != 0 && len(m.KeyColumnDirections) == 0 { + m.KeyColumnDirections = make([]SecondaryIndex_Direction, 0, elementCount) } for iNdEx < postIndex { - var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + var v SecondaryIndex_Direction for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -5367,88 +6083,19 @@ func (m *View) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + v |= SecondaryIndex_Direction(b&0x7F) << shift if b < 0x80 { break } } - m.DependsOn = append(m.DependsOn, v) + m.KeyColumnDirections = append(m.KeyColumnDirections, v) } } else { - return fmt.Errorf("proto: wrong wireType = %d for field DependsOn", wireType) - } - default: - iNdEx = preIndex - skippy, err := skipScpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthScpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Table) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Table: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Table: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) - } - m.TableID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift - if b < 0x80 { - break - } + return fmt.Errorf("proto: wrong wireType = %d for field KeyColumnDirections", wireType) } - case 2: + case 7: if wireType == 0 { - var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -5458,12 +6105,12 @@ func (m *Table) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift if b < 0x80 { break } } - m.DependedOnBy = append(m.DependedOnBy, v) + m.KeySuffixColumnIDs = append(m.KeySuffixColumnIDs, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -5498,11 +6145,11 @@ func (m *Table) Unmarshal(dAtA []byte) error { } } elementCount = count - if elementCount != 0 && len(m.DependedOnBy) == 0 { - m.DependedOnBy = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID, 0, elementCount) + if elementCount != 0 && len(m.KeySuffixColumnIDs) == 0 { + m.KeySuffixColumnIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) } for iNdEx < postIndex { - var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -5512,174 +6159,53 @@ func (m *Table) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift if b < 0x80 { break } } - m.DependedOnBy = append(m.DependedOnBy, v) + m.KeySuffixColumnIDs = append(m.KeySuffixColumnIDs, v) } } else { - return fmt.Errorf("proto: wrong wireType = %d for field DependedOnBy", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field KeySuffixColumnIDs", wireType) } - default: - iNdEx = preIndex - skippy, err := skipScpb(dAtA[iNdEx:]) - if err != nil { - return err + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ShardedDescriptor", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthScpb + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + if msglen < 0 { + return ErrInvalidLengthScpb } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TypeReference) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TypeReference: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TypeReference: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TypeID", wireType) - } - m.TypeID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TypeID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DescID", wireType) - } - m.DescID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DescID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipScpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { + postIndex := iNdEx + msglen + if postIndex < 0 { return ErrInvalidLengthScpb } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *OutboundForeignKey) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: OutboundForeignKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OutboundForeignKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OriginID", wireType) + if m.ShardedDescriptor == nil { + m.ShardedDescriptor = &descpb.ShardedDescriptor{} } - m.OriginID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.OriginID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift - if b < 0x80 { - break - } + if err := m.ShardedDescriptor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - case 3: + iNdEx = postIndex + case 9: if wireType == 0 { var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID for shift := uint(0); ; shift += 7 { @@ -5696,7 +6222,7 @@ func (m *OutboundForeignKey) Unmarshal(dAtA []byte) error { break } } - m.OriginColumns = append(m.OriginColumns, v) + m.StoringColumnIDs = append(m.StoringColumnIDs, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -5731,8 +6257,8 @@ func (m *OutboundForeignKey) Unmarshal(dAtA []byte) error { } } elementCount = count - if elementCount != 0 && len(m.OriginColumns) == 0 { - m.OriginColumns = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) + if elementCount != 0 && len(m.StoringColumnIDs) == 0 { + m.StoringColumnIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) } for iNdEx < postIndex { var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID @@ -5750,31 +6276,12 @@ func (m *OutboundForeignKey) Unmarshal(dAtA []byte) error { break } } - m.OriginColumns = append(m.OriginColumns, v) + m.StoringColumnIDs = append(m.StoringColumnIDs, v) } } else { - return fmt.Errorf("proto: wrong wireType = %d for field OriginColumns", wireType) - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ReferenceID", wireType) - } - m.ReferenceID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ReferenceID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift - if b < 0x80 { - break - } + return fmt.Errorf("proto: wrong wireType = %d for field StoringColumnIDs", wireType) } - case 5: + case 10: if wireType == 0 { var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID for shift := uint(0); ; shift += 7 { @@ -5791,7 +6298,7 @@ func (m *OutboundForeignKey) Unmarshal(dAtA []byte) error { break } } - m.ReferenceColumns = append(m.ReferenceColumns, v) + m.CompositeColumnIDs = append(m.CompositeColumnIDs, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -5826,8 +6333,8 @@ func (m *OutboundForeignKey) Unmarshal(dAtA []byte) error { } } elementCount = count - if elementCount != 0 && len(m.ReferenceColumns) == 0 { - m.ReferenceColumns = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) + if elementCount != 0 && len(m.CompositeColumnIDs) == 0 { + m.CompositeColumnIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) } for iNdEx < postIndex { var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID @@ -5845,16 +6352,16 @@ func (m *OutboundForeignKey) Unmarshal(dAtA []byte) error { break } } - m.ReferenceColumns = append(m.ReferenceColumns, v) + m.CompositeColumnIDs = append(m.CompositeColumnIDs, v) } } else { - return fmt.Errorf("proto: wrong wireType = %d for field ReferenceColumns", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CompositeColumnIDs", wireType) } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Inverted", wireType) } - var stringLen uint64 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -5864,24 +6371,32 @@ func (m *OutboundForeignKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthScpb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthScpb + m.Inverted = bool(v != 0) + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Concurrently", wireType) } - if postIndex > l { - return io.ErrUnexpectedEOF + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex + m.Concurrently = bool(v != 0) default: iNdEx = preIndex skippy, err := skipScpb(dAtA[iNdEx:]) @@ -5903,7 +6418,7 @@ func (m *OutboundForeignKey) Unmarshal(dAtA []byte) error { } return nil } -func (m *InboundForeignKey) Unmarshal(dAtA []byte) error { +func (m *SequenceDependency) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5926,17 +6441,17 @@ func (m *InboundForeignKey) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: InboundForeignKey: wiretype end group for non-group") + return fmt.Errorf("proto: SequenceDependency: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: InboundForeignKey: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: SequenceDependency: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OriginID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) } - m.OriginID = 0 + m.TableID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -5946,92 +6461,123 @@ func (m *InboundForeignKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.OriginID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift if b < 0x80 { break } } - case 3: - if wireType == 0 { - var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift - if b < 0x80 { - break - } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ColumnID", wireType) + } + m.ColumnID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb } - m.OriginColumns = append(m.OriginColumns, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } + if iNdEx >= l { + return io.ErrUnexpectedEOF } - if packedLen < 0 { - return ErrInvalidLengthScpb + b := dAtA[iNdEx] + iNdEx++ + m.ColumnID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthScpb + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SequenceID", wireType) + } + m.SequenceID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb } - if postIndex > l { + if iNdEx >= l { return io.ErrUnexpectedEOF } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } + b := dAtA[iNdEx] + iNdEx++ + m.SequenceID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break } - elementCount = count - if elementCount != 0 && len(m.OriginColumns) == 0 { - m.OriginColumns = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb } - for iNdEx < postIndex { - var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.OriginColumns = append(m.OriginColumns, v) + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= SequenceDependency_Type(b&0x7F) << shift + if b < 0x80 { + break } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field OriginColumns", wireType) } - case 4: + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UniqueConstraint) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UniqueConstraint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UniqueConstraint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ReferenceID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) } - m.ReferenceID = 0 + m.TableID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -6041,12 +6587,31 @@ func (m *InboundForeignKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ReferenceID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift if b < 0x80 { break } } - case 5: + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IndexID", wireType) + } + m.IndexID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IndexID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.IndexID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType == 0 { var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID for shift := uint(0); ; shift += 7 { @@ -6063,7 +6628,7 @@ func (m *InboundForeignKey) Unmarshal(dAtA []byte) error { break } } - m.ReferenceColumns = append(m.ReferenceColumns, v) + m.ColumnIDs = append(m.ColumnIDs, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -6098,8 +6663,8 @@ func (m *InboundForeignKey) Unmarshal(dAtA []byte) error { } } elementCount = count - if elementCount != 0 && len(m.ReferenceColumns) == 0 { - m.ReferenceColumns = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) + if elementCount != 0 && len(m.ColumnIDs) == 0 { + m.ColumnIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) } for iNdEx < postIndex { var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID @@ -6117,43 +6682,11 @@ func (m *InboundForeignKey) Unmarshal(dAtA []byte) error { break } } - m.ReferenceColumns = append(m.ReferenceColumns, v) + m.ColumnIDs = append(m.ColumnIDs, v) } } else { - return fmt.Errorf("proto: wrong wireType = %d for field ReferenceColumns", wireType) - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthScpb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthScpb - } - if postIndex > l { - return io.ErrUnexpectedEOF + return fmt.Errorf("proto: wrong wireType = %d for field ColumnIDs", wireType) } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipScpb(dAtA[iNdEx:]) @@ -6175,7 +6708,7 @@ func (m *InboundForeignKey) Unmarshal(dAtA []byte) error { } return nil } -func (m *SequenceOwnedBy) Unmarshal(dAtA []byte) error { +func (m *CheckConstraint) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6198,17 +6731,17 @@ func (m *SequenceOwnedBy) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: SequenceOwnedBy: wiretype end group for non-group") + return fmt.Errorf("proto: CheckConstraint: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: SequenceOwnedBy: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CheckConstraint: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SequenceID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) } - m.SequenceID = 0 + m.TableID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -6218,16 +6751,16 @@ func (m *SequenceOwnedBy) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.SequenceID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift if b < 0x80 { break } } case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerTableID", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } - m.OwnerTableID = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -6237,66 +6770,29 @@ func (m *SequenceOwnedBy) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.OwnerTableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - default: - iNdEx = preIndex - skippy, err := skipScpb(dAtA[iNdEx:]) - if err != nil { - return err + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthScpb } - if (skippy < 0) || (iNdEx+skippy) < 0 { + postIndex := iNdEx + intStringLen + if postIndex < 0 { return ErrInvalidLengthScpb } - if (iNdEx + skippy) > l { + if postIndex > l { return io.ErrUnexpectedEOF } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RelationDependedOnBy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowScpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RelationDependedOnBy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RelationDependedOnBy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expr", wireType) } - m.TableID = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -6306,16 +6802,105 @@ func (m *RelationDependedOnBy) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 2: + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Expr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType == 0 { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ColumnIDs = append(m.ColumnIDs, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.ColumnIDs) == 0 { + m.ColumnIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) + } + for iNdEx < postIndex { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ColumnIDs = append(m.ColumnIDs, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field ColumnIDs", wireType) + } + case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DependedOnBy", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Validated", wireType) } - m.DependedOnBy = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -6325,11 +6910,12 @@ func (m *RelationDependedOnBy) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DependedOnBy |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } + m.Validated = bool(v != 0) default: iNdEx = preIndex skippy, err := skipScpb(dAtA[iNdEx:]) @@ -6351,7 +6937,7 @@ func (m *RelationDependedOnBy) Unmarshal(dAtA []byte) error { } return nil } -func (m *Type) Unmarshal(dAtA []byte) error { +func (m *Sequence) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6374,17 +6960,17 @@ func (m *Type) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Type: wiretype end group for non-group") + return fmt.Errorf("proto: Sequence: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Type: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Sequence: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TypeID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SequenceID", wireType) } - m.TypeID = 0 + m.SequenceID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -6394,7 +6980,7 @@ func (m *Type) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TypeID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + m.SequenceID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift if b < 0x80 { break } @@ -6420,7 +7006,7 @@ func (m *Type) Unmarshal(dAtA []byte) error { } return nil } -func (m *Schema) Unmarshal(dAtA []byte) error { +func (m *DefaultExpression) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6443,17 +7029,17 @@ func (m *Schema) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Schema: wiretype end group for non-group") + return fmt.Errorf("proto: DefaultExpression: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Schema: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DefaultExpression: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SchemaID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) } - m.SchemaID = 0 + m.TableID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -6463,12 +7049,31 @@ func (m *Schema) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.SchemaID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift if b < 0x80 { break } } case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ColumnID", wireType) + } + m.ColumnID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ColumnID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType == 0 { var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID for shift := uint(0); ; shift += 7 { @@ -6485,7 +7090,7 @@ func (m *Schema) Unmarshal(dAtA []byte) error { break } } - m.DependentObjects = append(m.DependentObjects, v) + m.UsesSequenceIDs = append(m.UsesSequenceIDs, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -6520,8 +7125,8 @@ func (m *Schema) Unmarshal(dAtA []byte) error { } } elementCount = count - if elementCount != 0 && len(m.DependentObjects) == 0 { - m.DependentObjects = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID, 0, elementCount) + if elementCount != 0 && len(m.UsesSequenceIDs) == 0 { + m.UsesSequenceIDs = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID, 0, elementCount) } for iNdEx < postIndex { var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID @@ -6539,11 +7144,43 @@ func (m *Schema) Unmarshal(dAtA []byte) error { break } } - m.DependentObjects = append(m.DependentObjects, v) + m.UsesSequenceIDs = append(m.UsesSequenceIDs, v) } } else { - return fmt.Errorf("proto: wrong wireType = %d for field DependentObjects", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UsesSequenceIDs", wireType) + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultExpr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthScpb } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DefaultExpr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipScpb(dAtA[iNdEx:]) @@ -6565,7 +7202,7 @@ func (m *Schema) Unmarshal(dAtA []byte) error { } return nil } -func (m *Database) Unmarshal(dAtA []byte) error { +func (m *View) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6588,17 +7225,17 @@ func (m *Database) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Database: wiretype end group for non-group") + return fmt.Errorf("proto: View: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Database: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: View: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DatabaseID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) } - m.DatabaseID = 0 + m.TableID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScpb @@ -6608,7 +7245,7 @@ func (m *Database) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DatabaseID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift if b < 0x80 { break } @@ -6630,7 +7267,7 @@ func (m *Database) Unmarshal(dAtA []byte) error { break } } - m.DependentObjects = append(m.DependentObjects, v) + m.DependedOnBy = append(m.DependedOnBy, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -6665,8 +7302,8 @@ func (m *Database) Unmarshal(dAtA []byte) error { } } elementCount = count - if elementCount != 0 && len(m.DependentObjects) == 0 { - m.DependentObjects = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID, 0, elementCount) + if elementCount != 0 && len(m.DependedOnBy) == 0 { + m.DependedOnBy = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID, 0, elementCount) } for iNdEx < postIndex { var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID @@ -6684,11 +7321,1847 @@ func (m *Database) Unmarshal(dAtA []byte) error { break } } - m.DependentObjects = append(m.DependentObjects, v) + m.DependedOnBy = append(m.DependedOnBy, v) } } else { - return fmt.Errorf("proto: wrong wireType = %d for field DependentObjects", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DependedOnBy", wireType) } + case 3: + if wireType == 0 { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DependsOn = append(m.DependsOn, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.DependsOn) == 0 { + m.DependsOn = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID, 0, elementCount) + } + for iNdEx < postIndex { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DependsOn = append(m.DependsOn, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field DependsOn", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Table) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Table: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Table: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) + } + m.TableID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType == 0 { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DependedOnBy = append(m.DependedOnBy, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.DependedOnBy) == 0 { + m.DependedOnBy = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID, 0, elementCount) + } + for iNdEx < postIndex { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DependedOnBy = append(m.DependedOnBy, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field DependedOnBy", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TypeReference) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TypeReference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TypeReference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeID", wireType) + } + m.TypeID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TypeID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DescID", wireType) + } + m.DescID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DescID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OutboundForeignKey) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OutboundForeignKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OutboundForeignKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OriginID", wireType) + } + m.OriginID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OriginID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType == 0 { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OriginColumns = append(m.OriginColumns, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.OriginColumns) == 0 { + m.OriginColumns = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) + } + for iNdEx < postIndex { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OriginColumns = append(m.OriginColumns, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field OriginColumns", wireType) + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ReferenceID", wireType) + } + m.ReferenceID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ReferenceID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType == 0 { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ReferenceColumns = append(m.ReferenceColumns, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.ReferenceColumns) == 0 { + m.ReferenceColumns = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) + } + for iNdEx < postIndex { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ReferenceColumns = append(m.ReferenceColumns, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field ReferenceColumns", wireType) + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *InboundForeignKey) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: InboundForeignKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: InboundForeignKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OriginID", wireType) + } + m.OriginID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OriginID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType == 0 { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OriginColumns = append(m.OriginColumns, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.OriginColumns) == 0 { + m.OriginColumns = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) + } + for iNdEx < postIndex { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OriginColumns = append(m.OriginColumns, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field OriginColumns", wireType) + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ReferenceID", wireType) + } + m.ReferenceID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ReferenceID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType == 0 { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ReferenceColumns = append(m.ReferenceColumns, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.ReferenceColumns) == 0 { + m.ReferenceColumns = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID, 0, elementCount) + } + for iNdEx < postIndex { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ColumnID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ReferenceColumns = append(m.ReferenceColumns, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field ReferenceColumns", wireType) + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SequenceOwnedBy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SequenceOwnedBy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SequenceOwnedBy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SequenceID", wireType) + } + m.SequenceID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SequenceID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerTableID", wireType) + } + m.OwnerTableID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OwnerTableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RelationDependedOnBy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RelationDependedOnBy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RelationDependedOnBy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) + } + m.TableID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DependedOnBy", wireType) + } + m.DependedOnBy = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DependedOnBy |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Type) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Type: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Type: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeID", wireType) + } + m.TypeID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TypeID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Schema) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Schema: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Schema: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SchemaID", wireType) + } + m.SchemaID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SchemaID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType == 0 { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DependentObjects = append(m.DependentObjects, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.DependentObjects) == 0 { + m.DependentObjects = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID, 0, elementCount) + } + for iNdEx < postIndex { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DependentObjects = append(m.DependentObjects, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field DependentObjects", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Database) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Database: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Database: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DatabaseID", wireType) + } + m.DatabaseID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DatabaseID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType == 0 { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DependentObjects = append(m.DependentObjects, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.DependentObjects) == 0 { + m.DependentObjects = make([]github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID, 0, elementCount) + } + for iNdEx < postIndex { + var v github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DependentObjects = append(m.DependentObjects, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field DependentObjects", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListPartition) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListPartition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListPartition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Expr = append(m.Expr, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RangePartitions) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RangePartitions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RangePartitions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.To = append(m.To, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = append(m.From, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipScpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthScpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Partitioning) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Partitioning: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Partitioning: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TableID", wireType) + } + m.TableID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TableID |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.ID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IndexId", wireType) + } + m.IndexId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IndexId |= github_com_cockroachdb_cockroach_pkg_sql_catalog_descpb.IndexID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fields", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Fields = append(m.Fields, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListPartitions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ListPartitions = append(m.ListPartitions, &ListPartition{}) + if err := m.ListPartitions[len(m.ListPartitions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RangePartitions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthScpb + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthScpb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RangePartitions = append(m.RangePartitions, &RangePartitions{}) + if err := m.RangePartitions[len(m.RangePartitions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipScpb(dAtA[iNdEx:]) diff --git a/pkg/sql/schemachanger/scpb/scpb.proto b/pkg/sql/schemachanger/scpb/scpb.proto index 1706c0bc70ba..ddf8048f9e75 100644 --- a/pkg/sql/schemachanger/scpb/scpb.proto +++ b/pkg/sql/schemachanger/scpb/scpb.proto @@ -35,6 +35,7 @@ message ElementProto { Type type = 16; Schema schema = 17; Database database = 18; + Partitioning partitioning = 19; } message Target { @@ -69,17 +70,45 @@ message Column { } message PrimaryIndex { + // The direction of a column in the index. + enum Direction { + ASC = 0; + DESC = 1; + } option (gogoproto.equal) = true; uint32 table_id = 1 [(gogoproto.customname) = "TableID", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ID"]; - cockroach.sql.sqlbase.IndexDescriptor index = 2 [(gogoproto.nullable) = false]; - uint32 other_primary_index_id = 3 [(gogoproto.customname) = "OtherPrimaryIndexID", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.IndexID"]; + uint32 index_id = 2 [(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.IndexID"]; + string index_name = 3 [(gogoproto.customname) = "IndexName"]; + bool unique = 4 [(gogoproto.customname) = "Unique"]; + repeated uint32 key_column_ids = 5 [(gogoproto.customname) = "KeyColumnIDs", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID"]; + repeated Direction key_column_direction = 6 [(gogoproto.customname) = "KeyColumnDirections"]; + repeated uint32 key_suffix_column_ids = 7 [(gogoproto.customname) = "KeySuffixColumnIDs", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID"]; + cockroach.sql.sqlbase.ShardedDescriptor sharded_descriptor = 8 [(gogoproto.customname) = "ShardedDescriptor"]; + repeated uint32 storing_column_ids = 9 [(gogoproto.customname) = "StoringColumnIDs", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID"]; + repeated uint32 composite_column_ids = 10 [(gogoproto.customname) = "CompositeColumnIDs", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID"]; + bool inverted = 11 [(gogoproto.customname) = "Inverted"]; + bool concurrently = 12 [(gogoproto.customname) = "Concurrently"]; } message SecondaryIndex { + // The direction of a column in the index. + enum Direction { + ASC = 0; + DESC = 1; + } option (gogoproto.equal) = true; uint32 table_id = 1 [(gogoproto.customname) = "TableID", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ID"]; - cockroach.sql.sqlbase.IndexDescriptor index = 2 [(gogoproto.nullable) = false]; - uint32 primary_index = 3 [(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.IndexID"]; + uint32 index_id = 2 [(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.IndexID"]; + string index_name = 3 [(gogoproto.customname) = "IndexName"]; + bool unique = 4 [(gogoproto.customname) = "Unique"]; + repeated uint32 key_column_ids = 5 [(gogoproto.customname) = "KeyColumnIDs", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID"]; + repeated Direction key_column_direction = 6 [(gogoproto.customname) = "KeyColumnDirections"]; + repeated uint32 key_suffix_column_ids = 7 [(gogoproto.customname) = "KeySuffixColumnIDs", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID"]; + cockroach.sql.sqlbase.ShardedDescriptor sharded_descriptor = 8 [(gogoproto.customname) = "ShardedDescriptor"]; + repeated uint32 storing_column_ids = 9 [(gogoproto.customname) = "StoringColumnIDs", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID"]; + repeated uint32 composite_column_ids = 10 [(gogoproto.customname) = "CompositeColumnIDs", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ColumnID"]; + bool inverted = 11 [(gogoproto.customname) = "Inverted"]; + bool concurrently = 12 [(gogoproto.customname) = "Concurrently"]; } message SequenceDependency { @@ -189,3 +218,26 @@ message Database { uint32 database_id = 1 [(gogoproto.customname) = "DatabaseID", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ID"]; repeated uint32 dependentObjects = 2 [(gogoproto.customname) = "DependentObjects", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ID"]; } + +// FIXME: Dead code +message ListPartition { + option (gogoproto.equal) = true; + string name = 1 [(gogoproto.customname) = "Name"]; + repeated string expr = 2 [(gogoproto.customname) = "Expr"]; +} + +message RangePartitions { + option (gogoproto.equal) = true; + string name = 1 [(gogoproto.customname) = "Name"]; + repeated string To = 2 [(gogoproto.customname) = "To"]; + repeated string From = 3 [(gogoproto.customname) = "From"]; +} + +message Partitioning { + option (gogoproto.equal) = true; + uint32 table_id = 1 [(gogoproto.customname) = "TableID", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ID"]; + uint32 index_id = 2 [(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.IndexID"]; + repeated string fields = 3 [(gogoproto.customname) = "Fields"]; + repeated ListPartition list_partitions = 4 [(gogoproto.customname) = "ListPartitions"]; + repeated RangePartitions range_partitions = 5 [(gogoproto.customname) = "RangePartitions"]; +} diff --git a/pkg/sql/schemachanger/scplan/deprules/helpers.go b/pkg/sql/schemachanger/scplan/deprules/helpers.go index f0f9a7f3525a..65cbbbcf14e3 100644 --- a/pkg/sql/schemachanger/scplan/deprules/helpers.go +++ b/pkg/sql/schemachanger/scplan/deprules/helpers.go @@ -12,21 +12,6 @@ package deprules import "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" -func indexContainsColumn(idx *descpb.IndexDescriptor, colID descpb.ColumnID) bool { - return columnsContainsID(idx.KeyColumnIDs, colID) || - columnsContainsID(idx.StoreColumnIDs, colID) || - columnsContainsID(idx.KeySuffixColumnIDs, colID) -} - -func columnsContainsID(haystack []descpb.ColumnID, needle descpb.ColumnID) bool { - for _, id := range haystack { - if id == needle { - return true - } - } - return false -} - func idInIDs(objects []descpb.ID, id descpb.ID) bool { for _, other := range objects { if other == id { diff --git a/pkg/sql/schemachanger/scplan/deprules/rules.go b/pkg/sql/schemachanger/scplan/deprules/rules.go index d8f05c034649..304a50b212c0 100644 --- a/pkg/sql/schemachanger/scplan/deprules/rules.go +++ b/pkg/sql/schemachanger/scplan/deprules/rules.go @@ -131,16 +131,23 @@ func init() { } func init() { - + columnInList := func(targetColumn descpb.ColumnID, columnList descpb.ColumnIDs) bool { + for _, column := range columnList { + if targetColumn == column { + return true + } + } + return false + } column, columnTarget, columnNode := targetNodeVars("column") index, indexTarget, indexNode := targetNodeVars("index") - var id, status, direction rel.Var = "id", "status", "direction" + var id, status, direction rel.Var = "id", "index-status", "direction" register( "column depends on indexes", columnNode, indexNode, screl.MustQuery( - status.In(deleteAndWriteOnly, public), + status.In(deleteOnly, public), direction.Eq(add), column.Type((*scpb.Column)(nil)), @@ -151,20 +158,27 @@ func init() { rel.Filter( "columnInIndex", column, index, )(func(from *scpb.Column, to scpb.Element) bool { - var idx *descpb.IndexDescriptor switch to := to.(type) { case *scpb.PrimaryIndex: - idx = &to.Index + if columnInList(from.Column.ID, to.KeyColumnIDs) || + columnInList(from.Column.ID, to.StoringColumnIDs) || + columnInList(from.Column.ID, to.KeySuffixColumnIDs) { + return true + } case *scpb.SecondaryIndex: - idx = &to.Index + if columnInList(from.Column.ID, to.KeyColumnIDs) || + columnInList(from.Column.ID, to.StoringColumnIDs) || + columnInList(from.Column.ID, to.KeySuffixColumnIDs) { + return true + } default: panic(errors.AssertionFailedf("unexpected type %T", to)) } - return indexContainsColumn(idx, from.Column.ID) + return false }), direction.Entities(screl.Direction, columnTarget, indexTarget), - status.Entities(screl.Status, columnNode, indexNode), + status.Entities(screl.Status, indexNode), screl.JoinTargetNode(column, columnTarget, columnNode), screl.JoinTargetNode(index, indexTarget, indexNode), @@ -173,7 +187,6 @@ func init() { } func init() { - addIdx, addTarget, addNode := targetNodeVars("add-idx") dropIdx, dropTarget, dropNode := targetNodeVars("drop-idx") var id rel.Var = "id" @@ -185,13 +198,13 @@ func init() { rel.Filter( "referenceEachOther", addIdx, dropIdx, )(func(add, drop *scpb.PrimaryIndex) bool { - return add.OtherPrimaryIndexID == drop.Index.ID + return add.IndexId != drop.IndexId }), joinTargetNode(addIdx, addTarget, addNode, add, public), joinTargetNode(dropIdx, dropTarget, dropNode, - drop, deleteAndWriteOnly), + drop, deleteOnly), ) register( @@ -206,6 +219,53 @@ func init() { ) } +func init() { + addIdx, addTarget, addNode := targetNodeVars("add-idx") + partitioning, partitioningTarget, partitioningNode := targetNodeVars("partitioning") + var id rel.Var = "id" + + register( + "partitioning information needs the basic index as created", + partitioningNode, addNode, + screl.MustQuery( + addIdx.Type((*scpb.PrimaryIndex)(nil)), + partitioning.Type((*scpb.Partitioning)(nil)), + id.Entities(screl.DescID, addIdx, partitioning), + id.Entities(screl.IndexID, addIdx, partitioning), + + joinTargetNode(addIdx, addTarget, addNode, + add, deleteOnly), + joinTargetNode(partitioning, partitioningTarget, partitioningNode, + add, public), + ), + ) +} + +func init() { + addIdx, addTarget, addNode := targetNodeVars("add-idx") + partitioning, partitioningTarget, partitioningNode := targetNodeVars("partitioning") + var id rel.Var = "id" + + register( + "index needs partitioning information to be filled", + partitioningNode, addNode, + screl.MustQuery( + addIdx.Type((*scpb.PrimaryIndex)(nil)), + partitioning.Type((*scpb.Partitioning)(nil)), + id.Entities(screl.DescID, addIdx, partitioning), + id.Entities(screl.IndexID, addIdx, partitioning), + + joinTargetNode(addIdx, addTarget, addNode, + add, deleteAndWriteOnly), + joinTargetNode(partitioning, partitioningTarget, partitioningNode, + add, public), + ), + ) +} + +// TODO(ajwerner): What does this even mean? The sequence starts in +// public. + func init() { depNeedsRelationToExitSynthDrop := func(ruleName string, depTypes []interface{}, depDescIDMatch rel.Attr) { // Before any parts of a relation/type can be dropped, the relation diff --git a/pkg/sql/schemachanger/scplan/opgen/opgen_partitioning.go b/pkg/sql/schemachanger/scplan/opgen/opgen_partitioning.go new file mode 100644 index 000000000000..89413367ac55 --- /dev/null +++ b/pkg/sql/schemachanger/scplan/opgen/opgen_partitioning.go @@ -0,0 +1,35 @@ +// Copyright 2021 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package opgen + +import ( + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scop" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" +) + +func init() { + opRegistry.register( + (*scpb.Partitioning)(nil), + scpb.Target_ADD, + scpb.Status_ABSENT, + to(scpb.Status_PUBLIC, + minPhase(scop.PreCommitPhase), + emit(func(this *scpb.Partitioning) scop.Op { + return &scop.AddIndexPartitionInfo{ + TableID: this.TableID, + IndexID: this.IndexId, + PartitionFields: this.Fields, + ListPartitions: this.ListPartitions, + RangePartitions: this.RangePartitions, + } + }), + )) +} diff --git a/pkg/sql/schemachanger/scplan/opgen/opgen_primary_index.go b/pkg/sql/schemachanger/scplan/opgen/opgen_primary_index.go index 7e87c1c15078..cdfc3a0ea509 100644 --- a/pkg/sql/schemachanger/scplan/opgen/opgen_primary_index.go +++ b/pkg/sql/schemachanger/scplan/opgen/opgen_primary_index.go @@ -11,10 +11,27 @@ package opgen import ( + "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scop" "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" ) +func convertPrimaryIndexColumnDir( + primaryIndex *scpb.PrimaryIndex, +) []descpb.IndexDescriptor_Direction { + // Convert column directions + convertedColumnDirs := make([]descpb.IndexDescriptor_Direction, 0, len(primaryIndex.KeyColumnDirections)) + for _, columnDir := range primaryIndex.KeyColumnDirections { + switch columnDir { + case scpb.PrimaryIndex_DESC: + convertedColumnDirs = append(convertedColumnDirs, descpb.IndexDescriptor_DESC) + case scpb.PrimaryIndex_ASC: + convertedColumnDirs = append(convertedColumnDirs, descpb.IndexDescriptor_ASC) + } + } + return convertedColumnDirs +} + func init() { opRegistry.register( (*scpb.PrimaryIndex)(nil), @@ -24,8 +41,19 @@ func init() { minPhase(scop.PreCommitPhase), emit(func(this *scpb.PrimaryIndex) scop.Op { return &scop.MakeAddedIndexDeleteOnly{ - TableID: this.TableID, - Index: this.Index, + TableID: this.TableID, + IndexID: this.IndexId, + IndexName: this.IndexName, + Unique: this.Unique, + KeyColumnIDs: this.KeyColumnIDs, + KeyColumnDirections: convertPrimaryIndexColumnDir(this), + KeySuffixColumnIDs: this.KeySuffixColumnIDs, + StoreColumnIDs: this.StoringColumnIDs, + CompositeColumnIDs: this.CompositeColumnIDs, + ShardedDescriptor: this.ShardedDescriptor, + Inverted: this.Inverted, + Concurrently: this.Concurrently, + SecondaryIndex: false, } })), to(scpb.Status_DELETE_AND_WRITE_ONLY, @@ -33,14 +61,14 @@ func init() { emit(func(this *scpb.PrimaryIndex) scop.Op { return &scop.MakeAddedIndexDeleteAndWriteOnly{ TableID: this.TableID, - IndexID: this.Index.ID, + IndexID: this.IndexId, } })), to(scpb.Status_BACKFILLED, emit(func(this *scpb.PrimaryIndex) scop.Op { return &scop.BackfillIndex{ TableID: this.TableID, - IndexID: this.Index.ID, + IndexID: this.IndexId, } })), // If this index is unique (which primary indexes should be) and @@ -51,16 +79,15 @@ func init() { to(scpb.Status_VALIDATED, emit(func(this *scpb.PrimaryIndex) scop.Op { return &scop.ValidateUniqueIndex{ - TableID: this.TableID, - PrimaryIndexID: this.OtherPrimaryIndexID, - IndexID: this.Index.ID, + TableID: this.TableID, + IndexID: this.IndexId, } })), to(scpb.Status_PUBLIC, emit(func(this *scpb.PrimaryIndex) scop.Op { return &scop.MakeAddedPrimaryIndexPublic{ TableID: this.TableID, - Index: this.Index, + IndexID: this.IndexId, } })), ) @@ -75,7 +102,7 @@ func init() { // Most of this logic is taken from MakeMutationComplete(). return &scop.MakeDroppedPrimaryIndexDeleteAndWriteOnly{ TableID: this.TableID, - Index: this.Index, + IndexID: this.IndexId, } })), to(scpb.Status_DELETE_ONLY, @@ -85,7 +112,7 @@ func init() { emit(func(this *scpb.PrimaryIndex) scop.Op { return &scop.MakeDroppedIndexDeleteOnly{ TableID: this.TableID, - IndexID: this.Index.ID, + IndexID: this.IndexId, } })), to(scpb.Status_ABSENT, @@ -93,7 +120,7 @@ func init() { emit(func(this *scpb.PrimaryIndex) scop.Op { return &scop.MakeIndexAbsent{ TableID: this.TableID, - IndexID: this.Index.ID, + IndexID: this.IndexId, } })), ) diff --git a/pkg/sql/schemachanger/scplan/opgen/opgen_secondary_index.go b/pkg/sql/schemachanger/scplan/opgen/opgen_secondary_index.go index 890d25226b32..562d1b65ee73 100644 --- a/pkg/sql/schemachanger/scplan/opgen/opgen_secondary_index.go +++ b/pkg/sql/schemachanger/scplan/opgen/opgen_secondary_index.go @@ -10,5 +10,85 @@ package opgen +import ( + "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scop" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" +) + +func convertSecondaryIndexColumnDir( + secondaryIndex *scpb.SecondaryIndex, +) []descpb.IndexDescriptor_Direction { + // Convert column directions + convertedColumnDirs := make([]descpb.IndexDescriptor_Direction, 0, len(secondaryIndex.KeyColumnDirections)) + for _, columnDir := range secondaryIndex.KeyColumnDirections { + switch columnDir { + case scpb.SecondaryIndex_DESC: + convertedColumnDirs = append(convertedColumnDirs, descpb.IndexDescriptor_DESC) + case scpb.SecondaryIndex_ASC: + convertedColumnDirs = append(convertedColumnDirs, descpb.IndexDescriptor_ASC) + } + } + return convertedColumnDirs +} + func init() { + opRegistry.register( + (*scpb.SecondaryIndex)(nil), + scpb.Target_ADD, + scpb.Status_ABSENT, + to(scpb.Status_DELETE_ONLY, + minPhase(scop.PreCommitPhase), + emit(func(this *scpb.SecondaryIndex) scop.Op { + return &scop.MakeAddedIndexDeleteOnly{ + TableID: this.TableID, + IndexID: this.IndexId, + IndexName: this.IndexName, + Unique: this.Unique, + KeyColumnIDs: this.KeyColumnIDs, + KeyColumnDirections: convertSecondaryIndexColumnDir(this), + KeySuffixColumnIDs: this.KeySuffixColumnIDs, + StoreColumnIDs: this.StoringColumnIDs, + CompositeColumnIDs: this.CompositeColumnIDs, + ShardedDescriptor: this.ShardedDescriptor, + Inverted: this.Inverted, + Concurrently: this.Concurrently, + SecondaryIndex: true, + } + })), + to(scpb.Status_DELETE_AND_WRITE_ONLY, + minPhase(scop.PostCommitPhase), + emit(func(this *scpb.SecondaryIndex) scop.Op { + return &scop.MakeAddedIndexDeleteAndWriteOnly{ + TableID: this.TableID, + IndexID: this.IndexId, + } + })), + to(scpb.Status_BACKFILLED, + emit(func(this *scpb.SecondaryIndex) scop.Op { + return &scop.BackfillIndex{ + TableID: this.TableID, + IndexID: this.IndexId, + } + })), + // If this index is unique (which primary indexes should be) and + // there's not already a covering primary index, then we'll need to + // validate that this index indeed is unique. + // + // TODO(ajwerner): Rationalize this and hook up the optimization. + to(scpb.Status_VALIDATED, + emit(func(this *scpb.SecondaryIndex) scop.Op { + return &scop.ValidateUniqueIndex{ + TableID: this.TableID, + IndexID: this.IndexId, + } + })), + to(scpb.Status_PUBLIC, + emit(func(this *scpb.SecondaryIndex) scop.Op { + return &scop.MakeAddedPrimaryIndexPublic{ + TableID: this.TableID, + IndexID: this.IndexId, + } + })), + ) } diff --git a/pkg/sql/schemachanger/scplan/plan_test.go b/pkg/sql/schemachanger/scplan/plan_test.go index 26d62c0fb26f..d7d69715f8d8 100644 --- a/pkg/sql/schemachanger/scplan/plan_test.go +++ b/pkg/sql/schemachanger/scplan/plan_test.go @@ -53,7 +53,7 @@ func TestPlanAlterTable(t *testing.T) { tdb := sqlutils.MakeSQLRunner(sqlDB) run := func(t *testing.T, d *datadriven.TestData) string { switch d.Cmd { - case "create-view", "create-sequence", "create-table", "create-type", "create-database", "create-schema": + case "create-view", "create-sequence", "create-table", "create-type", "create-database", "create-schema", "create-index": stmts, err := parser.Parse(d.Input) require.NoError(t, err) require.Len(t, stmts, 1) @@ -71,6 +71,8 @@ func TestPlanAlterTable(t *testing.T) { tableName = "" case *tree.CreateSchema: tableName = "" + case *tree.CreateIndex: + tableName = "" default: t.Fatal("not a CREATE TABLE/SEQUENCE/VIEW statement") } diff --git a/pkg/sql/schemachanger/scplan/testdata/create_index b/pkg/sql/schemachanger/scplan/testdata/create_index new file mode 100644 index 000000000000..75b82db74aa6 --- /dev/null +++ b/pkg/sql/schemachanger/scplan/testdata/create_index @@ -0,0 +1,125 @@ +create-table +CREATE TABLE defaultdb.t1 (id INT PRIMARY KEY, name varchar(256), money int) +---- + +ops +CREATE INDEX id1 on defaultdb.t1(id, name) storing (money) +---- +Stage 0 + *scop.MakeAddedIndexDeleteOnly + IndexID: 2 + IndexName: id1 + KeyColumnDirections: + - 0 + - 0 + KeyColumnIDs: + - 1 + - 2 + SecondaryIndex: true + StoreColumnIDs: + - 3 + TableID: 52 +Stage 1 + *scop.MakeAddedIndexDeleteAndWriteOnly + IndexID: 2 + TableID: 52 +Stage 2 + scop.BackfillIndex + IndexID: 2 + TableID: 52 +Stage 3 + *scop.MakeAddedSecondaryIndexPublic + IndexID: 2 + TableID: 52 + +deps +CREATE INDEX id1 on defaultdb.t1(id, name) storing (money) +---- + +ops +CREATE INVERTED INDEX concurrently id1 on defaultdb.t1(id, name) storing (money) +---- +Stage 0 + *scop.MakeAddedIndexDeleteOnly + Concurrently: true + IndexID: 2 + IndexName: id1 + Inverted: true + KeyColumnDirections: + - 0 + - 0 + KeyColumnIDs: + - 1 + - 2 + SecondaryIndex: true + StoreColumnIDs: + - 3 + TableID: 52 +Stage 1 + *scop.MakeAddedIndexDeleteAndWriteOnly + IndexID: 2 + TableID: 52 +Stage 2 + scop.BackfillIndex + IndexID: 2 + TableID: 52 +Stage 3 + *scop.MakeAddedSecondaryIndexPublic + IndexID: 2 + TableID: 52 + +deps +CREATE INDEX id1 on defaultdb.t1(id, name) storing (money) +---- + +ops +CREATE INDEX id1 on defaultdb.t1(id, name) storing (money) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1) + ) +---- +Stage 0 + *scop.MakeAddedIndexDeleteOnly + IndexID: 2 + IndexName: id1 + KeyColumnDirections: + - 0 + - 0 + KeyColumnIDs: + - 1 + - 2 + SecondaryIndex: true + StoreColumnIDs: + - 3 + TableID: 52 + *scop.AddIndexPartitionInfo + IndexID: 2 + ListPartitions: + - name: p1 + expr: + - "1" + PartitionFields: + - id + RangePartitions: [] + TableID: 52 +Stage 1 + *scop.MakeAddedIndexDeleteAndWriteOnly + IndexID: 2 + TableID: 52 +Stage 2 + scop.BackfillIndex + IndexID: 2 + TableID: 52 +Stage 3 + *scop.MakeAddedSecondaryIndexPublic + IndexID: 2 + TableID: 52 + +deps +CREATE INDEX id1 on defaultdb.t1(id, name) storing (money) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1) + ) +---- +- from: [Partitioning:{DescID: 52, IndexID: 2}, PUBLIC] + to: [SecondaryIndex:{DescID: 52, ElementName: "id1", IndexID: 2}, DELETE_ONLY] +- from: [SecondaryIndex:{DescID: 52, ElementName: "id1", IndexID: 2}, DELETE_AND_WRITE_ONLY] + to: [Partitioning:{DescID: 52, IndexID: 2}, PUBLIC] diff --git a/pkg/sql/schemachanger/screl/attr.go b/pkg/sql/schemachanger/screl/attr.go index 2e7f5a344fb2..b7e62a594376 100644 --- a/pkg/sql/schemachanger/screl/attr.go +++ b/pkg/sql/schemachanger/screl/attr.go @@ -98,13 +98,13 @@ var Schema = rel.MustSchema("screl", ), rel.EntityMapping(t((*scpb.PrimaryIndex)(nil)), rel.EntityAttr(DescID, "TableID"), - rel.EntityAttr(IndexID, "Index.ID"), - rel.EntityAttr(Name, "Index.Name"), + rel.EntityAttr(IndexID, "IndexId"), + rel.EntityAttr(Name, "IndexName"), ), rel.EntityMapping(t((*scpb.SecondaryIndex)(nil)), rel.EntityAttr(DescID, "TableID"), - rel.EntityAttr(IndexID, "Index.ID"), - rel.EntityAttr(Name, "Index.Name"), + rel.EntityAttr(IndexID, "IndexId"), + rel.EntityAttr(Name, "IndexName"), ), rel.EntityMapping(t((*scpb.SequenceDependency)(nil)), rel.EntityAttr(DescID, "SequenceID"), @@ -163,6 +163,10 @@ var Schema = rel.MustSchema("screl", rel.EntityMapping(t((*scpb.Database)(nil)), rel.EntityAttr(DescID, "DatabaseID"), ), + rel.EntityMapping(t((*scpb.Partitioning)(nil)), + rel.EntityAttr(DescID, "TableID"), + rel.EntityAttr(IndexID, "IndexId"), + ), ) // JoinTargetNode generates a clause that joins the target and node vars