Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/sql/schemachanger/scexec/scmutationexec/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
4 changes: 4 additions & 0 deletions pkg/sql/schemachanger/scexec/scmutationexec/references.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Loading