From 57932f8fe2faf633e4388bbf8c9d5f4c26eb28bd Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Wed, 17 Apr 2024 19:50:59 -0400 Subject: [PATCH] Properly update field's ENUM/SET type when binary collation is used Signed-off-by: Matt Lord --- go/mysql/binlog/rbr.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/go/mysql/binlog/rbr.go b/go/mysql/binlog/rbr.go index 73c293a8750..a274d273da2 100644 --- a/go/mysql/binlog/rbr.go +++ b/go/mysql/binlog/rbr.go @@ -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. @@ -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)