mysqldump-php icon indicating copy to clipboard operation
mysqldump-php copied to clipboard

Resetting sql_mode on top of sql file breaks import when ANSI_QUOTES was in the original

Open Jalliuz opened this issue 2 years ago • 0 comments

I have the option "ANSI_QUOTES" in my original sql_mode. Which means the table names etc. get surrounded with double quotes in the exported sql

CREATE TABLE "my_table"

But on top of the exported sql there is this comment: /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;

So when importing the sql file again the sql_mode does not have the option ANSI_QUOTES anymore and the import fails fails because the dump has double quotes around table names and column names.

Solution is: if the option ANSI_QUOTES was present during the generation of the dump, it must stay present during the import too

Jalliuz avatar Feb 21 '24 15:02 Jalliuz