Skip to content

Commit

Permalink
typedesc: copy composite type elements in AsTypesT
Browse files Browse the repository at this point in the history
This commit adds copying for the elements of a composite type in the
`TypeDescriptor.AsTypesT` method. This avoids data races during type
hydration.

Fixes #119866

Release note: None
  • Loading branch information
DrewKimball committed Mar 4, 2024
1 parent a2420ac commit 1bec08c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/sql/catalog/typedesc/type_desc.go
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ func (desc *immutable) AsTypesT() *types.T {
contents := make([]*types.T, len(desc.Composite.Elements))
labels := make([]string, len(desc.Composite.Elements))
for i, e := range desc.Composite.Elements {
contents[i] = e.ElementType
contents[i] = e.ElementType.CopyForHydrate()
labels[i] = e.ElementLabel
}
return types.NewCompositeType(
Expand Down

0 comments on commit 1bec08c

Please sign in to comment.