backup-container icon indicating copy to clipboard operation
backup-container copied to clipboard

Restoring to MySQL fails when tables include generated columns

Open gvanhorne opened this issue 10 months ago • 0 comments

Judging from https://dba.stackexchange.com/a/279248, it sounds like

MariaDB's mysqldump dumps the generated values, but MySQL only accepts DEFAULT as value for a virtual generated column.

Creating the backup works no problem, but I get the following error when running ./backup.sh -r HOST:PORT/DATABASE:

ERROR 3105 (HY000) at line 2517: The value specified for generated column 'foo' in table 'bar' is not allowed.

I imagine this issue could be resolved by either:

  • Including the workaround using sed as described in the stackexchange answer as part of the restore script
  • Using an image which executes a non-mariadb version of mysqldump

I'll look to add reproduction steps soon!

gvanhorne avatar May 13 '25 22:05 gvanhorne