pt-table-sync doesn't work on JSON columns

Description

pt-table-sync v3.5.7 does not produce the correct SQL statements to properly sync tables containing JSON columns, at least testing against MySQL 5.7.12.

Steps to Reproduce

Pre-test Setup:

Test:

What’s going on:

pt-table-sync emits the following SQL:

The INSERT statement works fine, but the DELETE fails to delete the row with `id`='2', because the AND `data`='{"baz": "quux"}' portion of the WHERE clause will result in the query matching zero rows.

Verify the incorrect contents of the test_to table with the following:

That should return the following output:

Witness the row with id=2 still exists in the table, and was not deleted as it should have been.

With JSON columns, the DELETE statement would need to look like this:

You can non-destructively confirm this using this command:

That should return the following output:

Post-test Cleanup:

Environment

None

Activity

Show:

Aaditya Dubey April 8, 2024 at 4:17 PM
Edited

Hi

Thank you for the report and test case.
Verified as described.
This issue repeats with 8.0 as well.

Details

Assignee

Reporter

Priority

Components

Affects versions

Fix versions

Needs QA

Yes

Smart Checklist

Created April 6, 2024 at 1:00 AM
Updated December 30, 2024 at 9:34 AM