Skip to content

Instantly share code, notes, and snippets.

@chroder
Last active June 16, 2016 16:07
Show Gist options
  • Save chroder/18474448f7a08e0deb7de01055294010 to your computer and use it in GitHub Desktop.
Save chroder/18474448f7a08e0deb7de01055294010 to your computer and use it in GitHub Desktop.
--- /a/pt-online-schema-change 2016-03-07 09:09:45.000000000 +0000
+++ /b/pt-online-schema-change 2016-06-15 12:51:38.635743830 +0100
@@ -10031,11 +10031,7 @@
# This is in contrast to previous behavior were we added underscores
# indefinitely, sometimes exceeding the allowed name limit
# https://bugs.launchpad.net/percona-toolkit/+bug/1215587
- if ( $sql =~ /CONSTRAINT `_/ ) {
- $sql =~ s/^ CONSTRAINT `_/ CONSTRAINT `/gm;
- } else {
- $sql =~ s/^ CONSTRAINT `/ CONSTRAINT `_/gm;
- }
+ $sql =~ s/^ CONSTRAINT `(_?)/' CONSTRAINT `'.($1 eq '' ? '_' : '')/gme;
if ( $o->get('default-engine') ) {
$sql =~ s/\s+ENGINE=\S+//;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment