Skip to content

Commit

Permalink
Merge pull request #41426 from nvanbenschoten/backport19.2-41403
Browse files Browse the repository at this point in the history
release-19.2: sql/pgwire: avoid new memory allocation in writeTextDatum(Date)
  • Loading branch information
nvanbenschoten committed Oct 8, 2019
2 parents e0ce5fe + becd567 commit edcec3b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/sql/pgwire/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,8 @@ func (b *writeBuffer) writeTextDatum(
b.writeLengthPrefixedString(v.Contents)

case *tree.DDate:
s := v.Date.String()
b.putInt32(int32(len(s)))
b.write([]byte(s))
b.textFormatter.FormatNode(v)
b.writeFromFmtCtx(b.textFormatter)

case *tree.DTime:
// Start at offset 4 because `putInt32` clobbers the first 4 bytes.
Expand Down

0 comments on commit edcec3b

Please sign in to comment.