diff --git a/pkg/sql/schemachanger/scexec/scmutationexec/create.go b/pkg/sql/schemachanger/scexec/scmutationexec/create.go index 01d332664335..d82510fb5171 100644 --- a/pkg/sql/schemachanger/scexec/scmutationexec/create.go +++ b/pkg/sql/schemachanger/scexec/scmutationexec/create.go @@ -65,6 +65,10 @@ func (i *immediateVisitor) AddDescriptorName(ctx context.Context, op scop.AddDes switch t := desc.(type) { case *tabledesc.Mutable: t.ParentID = op.Namespace.DatabaseID + case *dbdesc.Mutable, *schemadesc.Mutable, *typedesc.Mutable: + // These descriptor types have their parent IDs set through other ops. + default: + return errors.AssertionFailedf("unexpected descriptor type %T for AddDescriptorName", desc) } return nil @@ -90,6 +94,8 @@ func (i *immediateVisitor) SetNameInDescriptor( // functions do not have a namespace entry and their name field is handled // by FunctionName element. return errors.AssertionFailedf("Incorrect descriptor type %v", mut.DescriptorType()) + default: + return errors.AssertionFailedf("unexpected descriptor type %v for SetNameInDescriptor", mut.DescriptorType()) } return nil } diff --git a/pkg/sql/schemachanger/scexec/scmutationexec/references.go b/pkg/sql/schemachanger/scexec/scmutationexec/references.go index 9d05104758a6..c8cf89a2b372 100644 --- a/pkg/sql/schemachanger/scexec/scmutationexec/references.go +++ b/pkg/sql/schemachanger/scexec/scmutationexec/references.go @@ -644,6 +644,10 @@ func (i *immediateVisitor) RemoveObjectParent( return err } sc.RemoveFunction(obj.GetName(), obj.GetID()) + case catalog.Table, catalog.Type: + // Schemas don't maintain back-references to tables or types. + default: + return errors.AssertionFailedf("unexpected descriptor type %v for RemoveObjectParent", obj.DescriptorType()) } return nil }