Skip to content

Commit

Permalink
fix: always write the server parameter description
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenrinzema committed Nov 18, 2023
1 parent 3ef8d24 commit fa73006
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)))

Expand Down

0 comments on commit fa73006

Please sign in to comment.