From fa730069b515eddb46d40ec36d76ac60336ead00 Mon Sep 17 00:00:00 2001 From: Jeroen Rinzema Date: Sat, 18 Nov 2023 15:14:29 +0100 Subject: [PATCH] fix: always write the server parameter description --- command.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/command.go b/command.go index 5e875b8..6080576 100644 --- a/command.go +++ b/command.go @@ -333,6 +333,10 @@ func (srv *Server) handleDescribe(ctx context.Context, reader *buffer.Reader, wr return err } + if statement == nil { + return ErrorCode(writer, errors.New("unknown statement")) + } + err = srv.writeParameterDescription(writer, statement.parameters) if err != nil { return err @@ -353,10 +357,6 @@ func (srv *Server) handleDescribe(ctx context.Context, reader *buffer.Reader, wr // https://www.postgresql.org/docs/15/protocol-message-formats.html func (srv *Server) writeParameterDescription(writer *buffer.Writer, parameters []oid.Oid) error { - if len(parameters) == 0 { - return nil - } - writer.Start(types.ServerParameterDescription) writer.AddInt16(int16(len(parameters)))