Date text encoding includes leading zero for month and day
e.g. 2000-01-01 instead of 2000-1-1. PostgreSQL accepted it without zeroes but our text decoder didn't. This caused a problem when we needed to take a value and encode to text so something else could parse it as if it had come from the PostgreSQL server in text format. e.g. database/sql compatibility.
This commit is contained in:
@@ -195,8 +195,14 @@ func (encodePlanDateCodecText) Encode(value any, buf []byte) (newBuf []byte, err
|
||||
|
||||
buf = strconv.AppendInt(buf, int64(year), 10)
|
||||
buf = append(buf, '-')
|
||||
if date.Time.Month() < 10 {
|
||||
buf = append(buf, '0')
|
||||
}
|
||||
buf = strconv.AppendInt(buf, int64(date.Time.Month()), 10)
|
||||
buf = append(buf, '-')
|
||||
if date.Time.Day() < 10 {
|
||||
buf = append(buf, '0')
|
||||
}
|
||||
buf = strconv.AppendInt(buf, int64(date.Time.Day()), 10)
|
||||
|
||||
if bc {
|
||||
|
||||
Reference in New Issue
Block a user