From 57fdabfe40b639a40cb226ba83ad512464598716 Mon Sep 17 00:00:00 2001 From: Nia Weiss Date: Fri, 28 Aug 2020 13:28:50 -0400 Subject: [PATCH] write empty column headers in postgres when there is no response --- pg/protocol.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pg/protocol.go b/pg/protocol.go index f0463ecc1..8a50baf05 100644 --- a/pg/protocol.go +++ b/pg/protocol.go @@ -394,6 +394,14 @@ func (s *Server) handleStandard(ctx context.Context, proto Protocol, conn net.Co return errors.Wrap(err, "failed to send query error to client") } } else { + if !qwriter.wroteHeaders { + // The handler did not write headers. + // Write back an empty set of headers. + err = qwriter.WriteHeader() + if err != nil { + return errors.Wrap(err, "sending empty column headers") + } + } // The query completed normally. // Notify the client of completion. msg, err = encoder.CommandComplete(qwriter.tag)