sqlbase: add validation for type cross references in table descs#51149
sqlbase: add validation for type cross references in table descs#51149craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
| if typeDesc, ok := typeMap[id]; ok { | ||
| return typeDesc, nil | ||
| } | ||
| typeDesc, err := GetTypeDescFromID(ctx, txn, codec, id) |
There was a problem hiding this comment.
wonder if we need to batch fetch these at one point.
There was a problem hiding this comment.
Yeah jordan brought up on a different PR to pass in an interface here rather than a txn to be smarter about the lookups done.
| // TODO(dan): Also validate SharedPrefixLen in the interleaves. | ||
|
|
||
| // Validate the all types present in the descriptor exist. | ||
| typeMap := make(map[ID]*TypeDescriptor) |
There was a problem hiding this comment.
if we're not using the return value, any reason to not just do util.FastIntSet?
also add a comment the function is a wrapper to do caching?
There was a problem hiding this comment.
It's not useful to use FastIntSet for things like descriptor ID's, since they are usually larger than 64. Also, the call to GetAllReferencedTypeIDs needs the TypeDescriptors.
64fcdb8 to
901d323
Compare
901d323 to
304cd9c
Compare
|
cc @dt for the discussion we had on slack. |
|
@dt can you take a look at the import changes here? |
This PR adds validation for any referenced types within a table descriptor. Release note (enterprise change): Disables the use of `IMPORT` with user defined types. Users should use `IMPORT INTO` instead.
304cd9c to
bffe18e
Compare
|
IMPORT changes look good to me. |
|
TFTR! bors r+ |
Build succeeded |
This PR adds validation for any referenced types within a table
descriptor.
Release note: None