Skip to content

Commit

Permalink
Merge pull request #2206 from alexandear/refactor-impossible-cond
Browse files Browse the repository at this point in the history
Refactor Conn.LoadTypes by removing redundant check
  • Loading branch information
jackc authored Dec 24, 2024
2 parents f7c3d19 + 311f72a commit bcf3fbd
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions derived_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,7 @@ func (c *Conn) LoadTypes(ctx context.Context, typeNames []string) ([]*pgtype.Typ
// the SQL not support recent structures such as multirange
serverVersion, _ := serverVersion(c)
sql := buildLoadDerivedTypesSQL(serverVersion, typeNames)
var rows Rows
var err error
if typeNames == nil {
rows, err = c.Query(ctx, sql, QueryExecModeSimpleProtocol)
} else {
rows, err = c.Query(ctx, sql, QueryExecModeSimpleProtocol, typeNames)
}
rows, err := c.Query(ctx, sql, QueryExecModeSimpleProtocol, typeNames)
if err != nil {
return nil, fmt.Errorf("While generating load types query: %w", err)
}
Expand Down

0 comments on commit bcf3fbd

Please sign in to comment.