Merge pull request #2206 from alexandear/refactor-impossible-cond

Refactor Conn.LoadTypes by removing redundant check
pull/2208/head
Jack Christensen 2024-12-24 11:14:17 -06:00 committed by GitHub
commit bcf3fbd780
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 7 deletions

View File

@ -169,13 +169,7 @@ func (c *Conn) LoadTypes(ctx context.Context, typeNames []string) ([]*pgtype.Typ
// the SQL not support recent structures such as multirange // the SQL not support recent structures such as multirange
serverVersion, _ := serverVersion(c) serverVersion, _ := serverVersion(c)
sql := buildLoadDerivedTypesSQL(serverVersion, typeNames) sql := buildLoadDerivedTypesSQL(serverVersion, typeNames)
var rows Rows rows, err := c.Query(ctx, sql, QueryExecModeSimpleProtocol, typeNames)
var err error
if typeNames == nil {
rows, err = c.Query(ctx, sql, QueryExecModeSimpleProtocol)
} else {
rows, err = c.Query(ctx, sql, QueryExecModeSimpleProtocol, typeNames)
}
if err != nil { if err != nil {
return nil, fmt.Errorf("While generating load types query: %w", err) return nil, fmt.Errorf("While generating load types query: %w", err)
} }