Produces several errors if a table is altered and has foreign keys / doesn't have any data / maybe something else. It can be fixed by calling ->ansi_to_legacy on the output of ->get_create_table, or by making the regexes understand ansi quoting.
Environment
None
Activity
Show:
lpjirasync
January 24, 2018 at 3:59 PM
**Comment from Launchpad by: Daniel Nichter on: 01-11-2012 17:39:37
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.
**Reported in Launchpad by Brian Fraser last update 16-11-2012 00:06:37
(This is our internal issue 26211 – reporting it here so it can be tagged for the next release)
Namely, this: NO_AUTO_VALUE_ON_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER
Produces several errors if a table is altered and has foreign keys / doesn't have any data / maybe something else. It can be fixed by calling ->ansi_to_legacy on the output of ->get_create_table, or by making the regexes understand ansi quoting.