@@ -161,7 +161,7 @@ type derivedTypeInfo struct {
161
161
// The result of this call can be passed into RegisterTypes to complete the process.
162
162
func (c * Conn ) LoadTypes (ctx context.Context , typeNames []string ) ([]* pgtype.Type , error ) {
163
163
m := c .TypeMap ()
164
- if typeNames == nil || len (typeNames ) == 0 {
164
+ if len (typeNames ) == 0 {
165
165
return nil , fmt .Errorf ("No type names were supplied." )
166
166
}
167
167
@@ -232,15 +232,15 @@ func (c *Conn) LoadTypes(ctx context.Context, typeNames []string) ([]*pgtype.Typ
232
232
default :
233
233
return nil , fmt .Errorf ("Unknown typtype %q was found while registering %q" , ti .Typtype , ti .TypeName )
234
234
}
235
- if type_ != nil {
236
- m .RegisterType (type_ )
237
- if ti .NspName != "" {
238
- nspType := & pgtype.Type {Name : ti .NspName + "." + type_ .Name , OID : type_ .OID , Codec : type_ .Codec }
239
- m .RegisterType (nspType )
240
- result = append (result , nspType )
241
- }
242
- result = append (result , type_ )
235
+
236
+ // the type_ is imposible to be null
237
+ m .RegisterType (type_ )
238
+ if ti .NspName != "" {
239
+ nspType := & pgtype.Type {Name : ti .NspName + "." + type_ .Name , OID : type_ .OID , Codec : type_ .Codec }
240
+ m .RegisterType (nspType )
241
+ result = append (result , nspType )
243
242
}
243
+ result = append (result , type_ )
244
244
}
245
245
return result , nil
246
246
}
0 commit comments