Include ParameterOIDs when preparing statements on new pool connections

ParameterOIDs passed to ConnPool.PrepareEx are used to prepare the statement
on existing connections in the pool. If additional connections are later
created ParameterOIDs are omitted, potentially causing query failures.
pull/589/head
Kale Blankenship 2019-08-28 12:50:51 -07:00
parent b2f5b7f3c4
commit 12c6319244
1 changed files with 2 additions and 1 deletions

View File

@ -341,7 +341,8 @@ func (p *ConnPool) afterConnectionCreated(c *Conn) (*Conn, error) {
}
for _, ps := range p.preparedStatements {
if _, err := c.Prepare(ps.Name, ps.SQL); err != nil {
opts := &PrepareExOptions{ParameterOIDs: ps.ParameterOIDs}
if _, err := c.PrepareEx(context.Background(), ps.Name, ps.SQL, opts); err != nil {
c.die(err)
return nil, err
}