-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql/catalog: clean up the descs.Collection resolution-by-ID methods #57539
Description
Currently descs.Collection has many methods for descriptor resolution by ID (for each descriptor type and for mutable vs. immutable, as well as GetMutableDescriptorByID for any descriptor type). These are backed by two different implementations for mutable vs. immutable descriptors which are somewhat divergent in their handling of uncommitted descriptors, non-public states, etc.
These implementations should be merged, and we should probably merge the interfaces as well. We could have a single method GetDescriptorByID, but that poses problems for catalog.ResolvedSchema. Maybe we'd have to do #57538 first. Another idea is to have GetMutableDescriptorByID (which evidently has some use now) and GetImmutableDescriptorByID, or something.
Part of the work here is just investigating what the current behavior is for non-public descriptors (and other less common cases) is. We're inconsistent about resolution for tables in the adding state, in particular.