danfengcao / binlog2sql

Parse MySQL binlog to SQL you want

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generated wrong SQL when `binlog_row_image = MINIMAL`

auntyellow opened this issue · comments

I have a table test with column id (PK) and val.

I got the correct SQL without additional binlog_row_image set (default is FULL):

UPDATE `test` SET `id`=1, `val`='2' WHERE `id`=1 AND `val`='2' LIMIT 1

But when I set binlog_row_image = MINIMAL, I got the wrong SQL:

UPDATE `test` SET `id`=NULL, `val`='2' WHERE `id`=1 AND `val` IS NULL LIMIT 1

Should be:

UPDATE `test` SET `val`='2' WHERE `id`=1 LIMIT 1

This is because id is omitted in after image and val is omitted in before image.

My MySQL version is 8.0.19