2
0

Do not asyncClose in response to a FATAL PG error

This will reduce spurious server log messages on authentication
failures. See https://github.com/jackc/pgconn/pull/53.
This commit is contained in:
Jack Christensen
2020-10-29 21:20:28 -05:00
parent f3f5b70a87
commit 340bfece2c
+2 -1
View File
@@ -485,7 +485,8 @@ func (pgConn *PgConn) receiveMessage() (pgproto3.BackendMessage, error) {
pgConn.parameterStatuses[msg.Name] = msg.Value
case *pgproto3.ErrorResponse:
if msg.Severity == "FATAL" {
pgConn.asyncClose()
pgConn.status = connStatusClosed
pgConn.conn.Close() // Ignore error as the connection is already broken and there is already an error to return.
return nil, ErrorResponseToPgError(msg)
}
case *pgproto3.NoticeResponse: