-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL8 causes dumps to omit defaulted columns using CURRENT_TIMESTAMP #273
Comments
Duplicate of #221 |
I have made rpm package for Centos 7 with this patch, and mydumper now works making backups of tables with problematic timestamp. The problem is loading the backup. Myloader does not create table from mydumper backups, showing a critical error:
I think myloader.c needs equivalent patch. |
@fcolope , I tested with @roccato table:
executed export and import like this:
The table was created correctly on test2:
with this information:
I run this test over: Percona Server 8.0.19-10.
Can you give me more info about your issue? |
Hi @davidducos , After some tests, by loading data dumped by mydumper with this patch, the problem is not caused by myloader. The problem was the sql_mode in mysql 8.0. In Magento 2 , some tables has default values as 0.
And MySQL 8.0 , by default, in sql_mode has NO_ZERO_DATE and NO_ZERO_IN_DATE. We have change MySQL sql_mode to allow this definition, because Magento 2 uses sql_mode="" setting inside php code. It's not a problem of myloader. Sorry. Best regards. |
Ok, closing it then. |
Say I had a table
CREATE TABLE `test` ( `id` int NOT NULL AUTO_INCREMENT, `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`);
The code mydumper uses to detect generated columns picks up
created_at
andupdated_at
because the information_schema.COLUMNS extra column for them containsDEFAULT_GENERATED
and it searches for values like%%GENERATED%%
I think it is reasonable to say that the expectation when dumping and and loading is to insert the original defaulted values. Not create new ones.
To that end I suggest changing
detect_generated_fields
in https://github.com/maxbube/mydumper/blob/master/mydumper.c where clause to includeextra not like '%%DEFAULT_GENERATED%%'
The text was updated successfully, but these errors were encountered: