Every Conn in a ConnPool gets its own PgTypes

Rather than sharing which could allow data races.
issue_145
Jack Christensen 2016-05-12 07:51:53 -05:00
parent f86340a92c
commit a488fe026f
1 changed files with 6 additions and 1 deletions

View File

@ -144,7 +144,12 @@ func connect(config ConnConfig, pgTypes map[Oid]PgType, pgsql_af_inet *byte, pgs
c = new(Conn) c = new(Conn)
c.config = config c.config = config
c.PgTypes = pgTypes if pgTypes != nil {
c.PgTypes = make(map[Oid]PgType, len(pgTypes))
for k, v := range pgTypes {
c.PgTypes[k] = v
}
}
c.pgsql_af_inet = pgsql_af_inet c.pgsql_af_inet = pgsql_af_inet
c.pgsql_af_inet6 = pgsql_af_inet6 c.pgsql_af_inet6 = pgsql_af_inet6