PT-202 pt-online-schema-change fails with virtual columns

Modified TableParser to ignore GENERATED columns from the columns list
used to construct SELECTs/INSERTs
This commit is contained in:
Carlos Salguero
2017-10-05 15:19:57 -03:00
parent 6ff61612f4
commit b51d09d811
16 changed files with 761 additions and 323 deletions

View File

@@ -1965,8 +1965,8 @@ sub parse {
my %def_for;
@def_for{@cols} = @defs;
my (@nums, @null);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc);
my (@nums, @null, @non_generated);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc, %is_generated);
foreach my $col ( @cols ) {
my $def = $def_for{$col};
@@ -1983,6 +1983,11 @@ sub parse {
push @null, $col;
$is_nullable{$col} = 1;
}
if ( remove_quoted_text($def) =~ m/\WGENERATED\W/i ) {
$is_generated{$col} = 1;
} else {
push @non_generated, $col;
}
$is_autoinc{$col} = $def =~ m/AUTO_INCREMENT/i ? 1 : 0;
}
@@ -1991,24 +1996,34 @@ sub parse {
my ($charset) = $ddl =~ m/DEFAULT CHARSET=(\w+)/;
return {
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @cols },
null_cols => \@null,
is_nullable => \%is_nullable,
is_autoinc => \%is_autoinc,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @non_generated },
null_cols => \@null,
is_nullable => \%is_nullable,
non_generated_cols => \@non_generated,
is_autoinc => \%is_autoinc,
is_generated => \%is_generated,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
};
}
sub remove_quoted_text {
my ($string) = @_;
$string =~ s/[^\\]`[^`]*[^\\]`//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
return $string;
}
sub sort_indexes {
my ( $self, $tbl ) = @_;

View File

@@ -352,8 +352,8 @@ sub parse {
my %def_for;
@def_for{@cols} = @defs;
my (@nums, @null);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc);
my (@nums, @null, @non_generated);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc, %is_generated);
foreach my $col ( @cols ) {
my $def = $def_for{$col};
@@ -370,6 +370,11 @@ sub parse {
push @null, $col;
$is_nullable{$col} = 1;
}
if ( remove_quoted_text($def) =~ m/\WGENERATED\W/i ) {
$is_generated{$col} = 1;
} else {
push @non_generated, $col;
}
$is_autoinc{$col} = $def =~ m/AUTO_INCREMENT/i ? 1 : 0;
}
@@ -378,24 +383,34 @@ sub parse {
my ($charset) = $ddl =~ m/DEFAULT CHARSET=(\w+)/;
return {
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @cols },
null_cols => \@null,
is_nullable => \%is_nullable,
is_autoinc => \%is_autoinc,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @non_generated },
null_cols => \@null,
is_nullable => \%is_nullable,
non_generated_cols => \@non_generated,
is_autoinc => \%is_autoinc,
is_generated => \%is_generated,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
};
}
sub remove_quoted_text {
my ($string) = @_;
$string =~ s/[^\\]`[^`]*[^\\]`//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
return $string;
}
sub sort_indexes {
my ( $self, $tbl ) = @_;

View File

@@ -1880,8 +1880,8 @@ sub parse {
my %def_for;
@def_for{@cols} = @defs;
my (@nums, @null);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc);
my (@nums, @null, @non_generated);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc, %is_generated);
foreach my $col ( @cols ) {
my $def = $def_for{$col};
@@ -1898,6 +1898,11 @@ sub parse {
push @null, $col;
$is_nullable{$col} = 1;
}
if ( remove_quoted_text($def) =~ m/\WGENERATED\W/i ) {
$is_generated{$col} = 1;
} else {
push @non_generated, $col;
}
$is_autoinc{$col} = $def =~ m/AUTO_INCREMENT/i ? 1 : 0;
}
@@ -1906,24 +1911,34 @@ sub parse {
my ($charset) = $ddl =~ m/DEFAULT CHARSET=(\w+)/;
return {
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @cols },
null_cols => \@null,
is_nullable => \%is_nullable,
is_autoinc => \%is_autoinc,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @non_generated },
null_cols => \@null,
is_nullable => \%is_nullable,
non_generated_cols => \@non_generated,
is_autoinc => \%is_autoinc,
is_generated => \%is_generated,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
};
}
sub remove_quoted_text {
my ($string) = @_;
$string =~ s/[^\\]`[^`]*[^\\]`//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
return $string;
}
sub sort_indexes {
my ( $self, $tbl ) = @_;

View File

@@ -3499,8 +3499,8 @@ sub parse {
my %def_for;
@def_for{@cols} = @defs;
my (@nums, @null);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc);
my (@nums, @null, @non_generated);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc, %is_generated);
foreach my $col ( @cols ) {
my $def = $def_for{$col};
@@ -3517,6 +3517,11 @@ sub parse {
push @null, $col;
$is_nullable{$col} = 1;
}
if ( remove_quoted_text($def) =~ m/\WGENERATED\W/i ) {
$is_generated{$col} = 1;
} else {
push @non_generated, $col;
}
$is_autoinc{$col} = $def =~ m/AUTO_INCREMENT/i ? 1 : 0;
}
@@ -3525,24 +3530,34 @@ sub parse {
my ($charset) = $ddl =~ m/DEFAULT CHARSET=(\w+)/;
return {
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @cols },
null_cols => \@null,
is_nullable => \%is_nullable,
is_autoinc => \%is_autoinc,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @non_generated },
null_cols => \@null,
is_nullable => \%is_nullable,
non_generated_cols => \@non_generated,
is_autoinc => \%is_autoinc,
is_generated => \%is_generated,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
};
}
sub remove_quoted_text {
my ($string) = @_;
$string =~ s/[^\\]`[^`]*[^\\]`//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
return $string;
}
sub sort_indexes {
my ( $self, $tbl ) = @_;

View File

@@ -3119,8 +3119,8 @@ sub parse {
my %def_for;
@def_for{@cols} = @defs;
my (@nums, @null);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc);
my (@nums, @null, @non_generated);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc, %is_generated);
foreach my $col ( @cols ) {
my $def = $def_for{$col};
@@ -3137,6 +3137,11 @@ sub parse {
push @null, $col;
$is_nullable{$col} = 1;
}
if ( remove_quoted_text($def) =~ m/\WGENERATED\W/i ) {
$is_generated{$col} = 1;
} else {
push @non_generated, $col;
}
$is_autoinc{$col} = $def =~ m/AUTO_INCREMENT/i ? 1 : 0;
}
@@ -3145,24 +3150,34 @@ sub parse {
my ($charset) = $ddl =~ m/DEFAULT CHARSET=(\w+)/;
return {
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @cols },
null_cols => \@null,
is_nullable => \%is_nullable,
is_autoinc => \%is_autoinc,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @non_generated },
null_cols => \@null,
is_nullable => \%is_nullable,
non_generated_cols => \@non_generated,
is_autoinc => \%is_autoinc,
is_generated => \%is_generated,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
};
}
sub remove_quoted_text {
my ($string) = @_;
$string =~ s/[^\\]`[^`]*[^\\]`//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
return $string;
}
sub sort_indexes {
my ( $self, $tbl ) = @_;

View File

@@ -2945,8 +2945,8 @@ sub parse {
my %def_for;
@def_for{@cols} = @defs;
my (@nums, @null);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc);
my (@nums, @null, @non_generated);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc, %is_generated);
foreach my $col ( @cols ) {
my $def = $def_for{$col};
@@ -2963,6 +2963,11 @@ sub parse {
push @null, $col;
$is_nullable{$col} = 1;
}
if ( remove_quoted_text($def) =~ m/\WGENERATED\W/i ) {
$is_generated{$col} = 1;
} else {
push @non_generated, $col;
}
$is_autoinc{$col} = $def =~ m/AUTO_INCREMENT/i ? 1 : 0;
}
@@ -2971,24 +2976,34 @@ sub parse {
my ($charset) = $ddl =~ m/DEFAULT CHARSET=(\w+)/;
return {
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @cols },
null_cols => \@null,
is_nullable => \%is_nullable,
is_autoinc => \%is_autoinc,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @non_generated },
null_cols => \@null,
is_nullable => \%is_nullable,
non_generated_cols => \@non_generated,
is_autoinc => \%is_autoinc,
is_generated => \%is_generated,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
};
}
sub remove_quoted_text {
my ($string) = @_;
$string =~ s/[^\\]`[^`]*[^\\]`//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
return $string;
}
sub sort_indexes {
my ( $self, $tbl ) = @_;

View File

@@ -56,7 +56,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -3309,8 +3309,8 @@ sub parse {
my %def_for;
@def_for{@cols} = @defs;
my (@nums, @null);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc);
my (@nums, @null, @non_generated);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc, %is_generated);
foreach my $col ( @cols ) {
my $def = $def_for{$col};
@@ -3327,6 +3327,11 @@ sub parse {
push @null, $col;
$is_nullable{$col} = 1;
}
if ( remove_quoted_text($def) =~ m/\WGENERATED\W/i ) {
$is_generated{$col} = 1;
} else {
push @non_generated, $col;
}
$is_autoinc{$col} = $def =~ m/AUTO_INCREMENT/i ? 1 : 0;
}
@@ -3335,24 +3340,34 @@ sub parse {
my ($charset) = $ddl =~ m/DEFAULT CHARSET=(\w+)/;
return {
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @cols },
null_cols => \@null,
is_nullable => \%is_nullable,
is_autoinc => \%is_autoinc,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @non_generated },
null_cols => \@null,
is_nullable => \%is_nullable,
non_generated_cols => \@non_generated,
is_autoinc => \%is_autoinc,
is_generated => \%is_generated,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
};
}
sub remove_quoted_text {
my ($string) = @_;
$string =~ s/[^\\]`[^`]*[^\\]`//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
return $string;
}
sub sort_indexes {
my ( $self, $tbl ) = @_;
@@ -11582,6 +11597,11 @@ The tool exits with an error if the host is a cluster node and the table
is MyISAM or is being converted to MyISAM (C<ENGINE=MyISAM>), or if
C<wsrep_OSU_method> is not C<TOI>. There is no way to disable these checks.
=head1 MySQL 5.7+ Generated columns
The tools ignores MySQL 5.7+ C<GENERATED> columns since the value for those columns
is generated according to the expresion used to compute column values.
=head1 OUTPUT
The tool prints information about its activities to STDOUT so that you can see

View File

@@ -8857,8 +8857,8 @@ sub parse {
my %def_for;
@def_for{@cols} = @defs;
my (@nums, @null);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc);
my (@nums, @null, @non_generated);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc, %is_generated);
foreach my $col ( @cols ) {
my $def = $def_for{$col};
@@ -8875,6 +8875,11 @@ sub parse {
push @null, $col;
$is_nullable{$col} = 1;
}
if ( remove_quoted_text($def) =~ m/\WGENERATED\W/i ) {
$is_generated{$col} = 1;
} else {
push @non_generated, $col;
}
$is_autoinc{$col} = $def =~ m/AUTO_INCREMENT/i ? 1 : 0;
}
@@ -8883,24 +8888,34 @@ sub parse {
my ($charset) = $ddl =~ m/DEFAULT CHARSET=(\w+)/;
return {
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @cols },
null_cols => \@null,
is_nullable => \%is_nullable,
is_autoinc => \%is_autoinc,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @non_generated },
null_cols => \@null,
is_nullable => \%is_nullable,
non_generated_cols => \@non_generated,
is_autoinc => \%is_autoinc,
is_generated => \%is_generated,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
};
}
sub remove_quoted_text {
my ($string) = @_;
$string =~ s/[^\\]`[^`]*[^\\]`//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
return $string;
}
sub sort_indexes {
my ( $self, $tbl ) = @_;

View File

@@ -4446,8 +4446,8 @@ sub parse {
my %def_for;
@def_for{@cols} = @defs;
my (@nums, @null);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc);
my (@nums, @null, @non_generated);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc, %is_generated);
foreach my $col ( @cols ) {
my $def = $def_for{$col};
@@ -4464,6 +4464,11 @@ sub parse {
push @null, $col;
$is_nullable{$col} = 1;
}
if ( remove_quoted_text($def) =~ m/\WGENERATED\W/i ) {
$is_generated{$col} = 1;
} else {
push @non_generated, $col;
}
$is_autoinc{$col} = $def =~ m/AUTO_INCREMENT/i ? 1 : 0;
}
@@ -4472,24 +4477,34 @@ sub parse {
my ($charset) = $ddl =~ m/DEFAULT CHARSET=(\w+)/;
return {
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @cols },
null_cols => \@null,
is_nullable => \%is_nullable,
is_autoinc => \%is_autoinc,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @non_generated },
null_cols => \@null,
is_nullable => \%is_nullable,
non_generated_cols => \@non_generated,
is_autoinc => \%is_autoinc,
is_generated => \%is_generated,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
};
}
sub remove_quoted_text {
my ($string) = @_;
$string =~ s/[^\\]`[^`]*[^\\]`//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
return $string;
}
sub sort_indexes {
my ( $self, $tbl ) = @_;

View File

@@ -2864,8 +2864,8 @@ sub parse {
my %def_for;
@def_for{@cols} = @defs;
my (@nums, @null);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc);
my (@nums, @null, @non_generated);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc, %is_generated);
foreach my $col ( @cols ) {
my $def = $def_for{$col};
@@ -2882,6 +2882,11 @@ sub parse {
push @null, $col;
$is_nullable{$col} = 1;
}
if ( remove_quoted_text($def) =~ m/\WGENERATED\W/i ) {
$is_generated{$col} = 1;
} else {
push @non_generated, $col;
}
$is_autoinc{$col} = $def =~ m/AUTO_INCREMENT/i ? 1 : 0;
}
@@ -2890,24 +2895,34 @@ sub parse {
my ($charset) = $ddl =~ m/DEFAULT CHARSET=(\w+)/;
return {
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @cols },
null_cols => \@null,
is_nullable => \%is_nullable,
is_autoinc => \%is_autoinc,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @non_generated },
null_cols => \@null,
is_nullable => \%is_nullable,
non_generated_cols => \@non_generated,
is_autoinc => \%is_autoinc,
is_generated => \%is_generated,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
};
}
sub remove_quoted_text {
my ($string) = @_;
$string =~ s/[^\\]`[^`]*[^\\]`//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
return $string;
}
sub sort_indexes {
my ( $self, $tbl ) = @_;

View File

@@ -6795,8 +6795,8 @@ sub parse {
my %def_for;
@def_for{@cols} = @defs;
my (@nums, @null);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc);
my (@nums, @null, @non_generated);
my (%type_for, %is_nullable, %is_numeric, %is_autoinc, %is_generated);
foreach my $col ( @cols ) {
my $def = $def_for{$col};
@@ -6813,6 +6813,11 @@ sub parse {
push @null, $col;
$is_nullable{$col} = 1;
}
if ( remove_quoted_text($def) =~ m/\WGENERATED\W/i ) {
$is_generated{$col} = 1;
} else {
push @non_generated, $col;
}
$is_autoinc{$col} = $def =~ m/AUTO_INCREMENT/i ? 1 : 0;
}
@@ -6821,24 +6826,34 @@ sub parse {
my ($charset) = $ddl =~ m/DEFAULT CHARSET=(\w+)/;
return {
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @cols },
null_cols => \@null,
is_nullable => \%is_nullable,
is_autoinc => \%is_autoinc,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
name => $name,
cols => \@cols,
col_posn => { map { $cols[$_] => $_ } 0..$#cols },
is_col => { map { $_ => 1 } @non_generated },
null_cols => \@null,
is_nullable => \%is_nullable,
non_generated_cols => \@non_generated,
is_autoinc => \%is_autoinc,
is_generated => \%is_generated,
clustered_key => $clustered_key,
keys => $keys,
defs => \%def_for,
numeric_cols => \@nums,
is_numeric => \%is_numeric,
engine => $engine,
type_for => \%type_for,
charset => $charset,
};
}
sub remove_quoted_text {
my ($string) = @_;
$string =~ s/[^\\]`[^`]*[^\\]`//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
return $string;
}
sub sort_indexes {
my ( $self, $tbl ) = @_;