2
0

Return deferred errors

Deferred errors are sent after the CommandComplete message. They could
be silently dropped depending on the context in which it occurred.

fixes #570
This commit is contained in:
Jack Christensen
2019-08-06 16:42:20 -05:00
parent 8f5ec93e18
commit ca9de51256
5 changed files with 156 additions and 1 deletions
+17
View File
@@ -268,6 +268,23 @@ func (b *Batch) Close() (err error) {
}
}
for b.conn.pendingReadyForQueryCount > 0 {
msg, err := b.conn.rxMsg()
if err != nil {
return err
}
switch msg := msg.(type) {
case *pgproto3.ErrorResponse:
return b.conn.rxErrorResponse(msg)
default:
err = b.conn.processContextFreeMsg(msg)
if err != nil {
return err
}
}
}
if err = b.conn.ensureConnectionReadyForQuery(); err != nil {
return err
}