Column data lost when 'Generated' is in the column comment

Description

Impact on the user:

  • All data in some columns are lost

Steps to reproduce:
1. Create data as described in the initial description:

2. Check content of the table:

3. Run pt-osc:

4. Check content of the table again:

Actual result:

Notice that the column "Password" is empty.

Expected Result:

Workaround:
N/A

Details
: Issue here is that GENERATED is a keyword since 5.7 which allows to have generated columns. E.g. columns with no data, but storing calculated values. Can be something like: foo INT GENERATED ALWAYS AS 2+2

Original report:

After changing a table with pt-online-schema-change the data for one column was lost, this seems related to the word 'Generated' on the column comment.

Command: pt-online-schema-change --alter "ADD COLUMN c1 INT" D=test_kevin,t=MemberTest --execute
Version: pt-online-schema-change 3.2.1
Server version: 5.7.16-10-57

Test data:

 

This issue might be related to , however that should be fixed it seems.

Environment

None

Attachments

1

Smart Checklist

Activity

Show:

Sveta Smirnova February 13, 2021 at 7:20 PM

How to Repeat.

1. Create data as described in the initial description:

2. Check content of the table:

3. Run pt-osc:

4. Check content of the table again:

Notice that the column "Password" is empty.

Sveta Smirnova February 13, 2021 at 3:43 PM

is not repeatable anymore. Looks like this is the issue what was not fixed by .

Jericho Rivera February 13, 2021 at 2:55 PM

This doesn't look like it is just because of the presence of GENERATED in the column comment but rather a combination of column flags NOT NULL DEFAULT '' COMMENT 'Generated' based on my tests.

These works:

 

 

 

While these doesn't:

 

 

 

We can see the tool identifies the table columns but creates the wrong triggers missing the affected column:

Done

Details

Assignee

Reporter

Priority

Affects versions

Fix versions

Needs Review

Yes

Sprint

Smart Checklist

Created December 14, 2020 at 2:18 AM
Updated February 29, 2024 at 8:55 PM
Resolved March 9, 2021 at 2:46 PM