mirror of https://github.com/jackc/pgx.git
Merge pull request #2206 from alexandear/refactor-impossible-cond
Refactor Conn.LoadTypes by removing redundant checkpull/2208/head
commit
bcf3fbd780
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue