Comment 1 for bug 1058285

Revision history for this message
Daniel Nichter (daniel-nichter) wrote : Re: pt-online-schema-change doesn't work with ANSI_QUOTES + some other sql_modes

ANSI_QUOTES, no matter how they're enabled in SQL_MODE, caused pt-online-schema-change to fail on tables with foreign keys because to rebuild the fk constraints we parsed them like m/CONSTRAINT `.../ -- that is, expecting idents to be backtick (`) quoted. But TableParser::get_create_table() was only temporarily removing ANSI_QUOTES, which failed if SQL_MODE had a mode like ORACLE which implicitly enables ANSI_QUOTES. Brian's fix made the sub also remove such modes, but then I altered the code to simply set SQL_MODE='' before doing SHOW CREATE TABLE, then restore the original mode. SQL_MODE='' is MySQL's default, and it's what the sub needs, and the sub only does SHOW CREATE TABLE, so temporarily ignoring all user-set SQL modes in this case should be ok.