@@ -150,20 +150,20 @@ func (c *PostgresConnector) fetchCustomTypeMapping(ctx context.Context, version
150
150
c .customTypeMapping = customTypeMapping
151
151
152
152
if version >= shared .InternalVersion_CompositeTypeAsTuple {
153
- var compositeTypeNames []string
154
- for _ , typeData := range customTypeMapping {
155
- if typeData .Type == 'c' && typeData .Delim == 0 { // Only composite types
156
- compositeTypeNames = append (compositeTypeNames , typeData .Name )
153
+ var compositeTypeNames []string
154
+ for _ , typeData := range customTypeMapping {
155
+ if typeData .Type == 'c' && typeData .Delim == 0 { // Only composite types
156
+ compositeTypeNames = append (compositeTypeNames , typeData .Name )
157
+ }
157
158
}
159
+ types , err := c .conn .LoadTypes (ctx , compositeTypeNames )
160
+ if err != nil {
161
+ c .logger .Error ("failed to load composite types" ,
162
+ slog .Any ("error" , err ), slog .Any ("composite_type_names" , compositeTypeNames ))
163
+ return nil , fmt .Errorf ("failed to load composite types: %w" , err )
164
+ }
165
+ c .typeMap .RegisterTypes (types )
158
166
}
159
- types , err := c .conn .LoadTypes (ctx , compositeTypeNames )
160
- if err != nil {
161
- c .logger .Error ("failed to load composite types" ,
162
- slog .Any ("error" , err ), slog .Any ("composite_type_names" , compositeTypeNames ))
163
- return nil , fmt .Errorf ("failed to load composite types: %w" , err )
164
- }
165
- c .typeMap .RegisterTypes (types )
166
- }
167
167
}
168
168
return c .customTypeMapping , nil
169
169
}
@@ -941,11 +941,12 @@ func (c *PostgresConnector) GetSelectedColumns(
941
941
}
942
942
943
943
func (c * PostgresConnector ) getCompositeTypeDetails (ctx context.Context , system protos.TypeSystem , version uint32 ,
944
- customTypeMapping map [uint32 ]shared.CustomDataType , OID uint32 ) ([]* protos.FieldDescription , error ) {
944
+ customTypeMapping map [uint32 ]shared.CustomDataType , oid uint32 ,
945
+ ) ([]* protos.FieldDescription , error ) {
945
946
result := make ([]* protos.FieldDescription , 0 )
946
- subfields , err := shared .GetCompositeDataTypeDetails (ctx , c .conn , OID )
947
+ subfields , err := shared .GetCompositeDataTypeDetails (ctx , c .conn , oid )
947
948
if err != nil {
948
- return nil , fmt .Errorf ("error getting composite data type details for %d: %w" , OID , err )
949
+ return nil , fmt .Errorf ("error getting composite data type details for %d: %w" , oid , err )
949
950
}
950
951
for _ , subfield := range subfields {
951
952
var subColType string
0 commit comments