Skip to content

Commit

Permalink
Properly update field's ENUM/SET type when binary collation is used
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord committed Apr 17, 2024
1 parent 96d50f5 commit 57932f8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions go/mysql/binlog/rbr.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,11 @@ func CellValue(data []byte, pos int, typ byte, metadata uint16, field *querypb.F
// metadata. If it's a string, then there will be more bits.
t := metadata >> 8
if t == TypeEnum {
// We don't know the string values. So just use the
// numbers.
// Update the field's type to ensure proper handling in
// upper layers.
field.Type = querypb.Type_ENUM
// We don't know the string values. Those will be filled
// in upper layers.
switch metadata & 0xff {
case 1:
// One byte storage.
Expand All @@ -714,6 +717,9 @@ func CellValue(data []byte, pos int, typ byte, metadata uint16, field *querypb.F
}
}
if t == TypeSet {
// Update the field's type to ensure proper handling in
// upper layers.
field.Type = querypb.Type_SET
// We don't know the set values. So just use the
// numbers.
l := int(metadata & 0xff)
Expand Down

0 comments on commit 57932f8

Please sign in to comment.