Bug #78082 mysqlpump makes corrupted dump when table has generated column
Submitted: 15 Aug 2015 6:42 Modified: 19 Nov 2015 14:01
Reporter: Tsubasa Tanaka (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:5.7.8 OS:CentOS (6.6)
Assigned to: CPU Architecture:Any

[15 Aug 2015 6:42] Tsubasa Tanaka
Description:
mysqldump and mysqlpump make unrestorable dump file when table has generated column.

They handle generated column as same as normal column but actually mysqld doesn't allow inserting data into generated columns by Error 3105.

How to repeat:
mysql57> create table t1 (num int, v_col int AS (num + 1) VIRTUAL);
Query OK, 0 rows affected (0.02 sec)

mysql57> INSERT INTO t1 (num) VALUES (1);
Query OK, 1 row affected (0.01 sec)

mysql57> SELECT * FROM t1;
+------+-------+
| num  | v_col |
+------+-------+
|    1 |     2 |
+------+-------+
1 row in set (0.00 sec)

$ /usr/mysql/5.7.8/bin/mysqlpump -u root -S /usr/mysql/5.7.8/data/mysql.sock d1 > d1.sql
Dump progress: 0/1 tables, 1/1 rows
Dump completed in 422 milliseconds

mysql57> drop database d1;
Query OK, 1 row affected (0.01 sec)

$ mysql57 < d1.sql
ERROR 3105 (HY000) at line 19: The value specified for generated column 'v_col' in table 't1' is not allowed.

Suggested fix:
Handle generated column correctly.
[18 Aug 2015 9:42] MySQL Verification Team
Hello Tsubasa-San,

Thank you for the report.

Thanks,
Umesh
[19 Nov 2015 14:01] Paul DuBois
Noted in 5.7.11, 5.8.0 changelog.

mysqlpump generated correct INSERT statements for tables that had
generated columns.
[16 Jan 2016 15:32] Paul DuBois
correct => incorrect