mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-02 02:34:19 +00:00
PT-2375 - fixed pt-table-sync for tables with generated columns
Previously, pt-table-sync generated DML statements that included the generated columns of a table, which is however rejected by the database and not necessary for the required sync statements.
This commit is contained in:
@@ -462,7 +462,8 @@ sub get_changes {
|
||||
|
||||
|
||||
# Sub: sort_cols
|
||||
# Sort a row's columns based on their real order in the table.
|
||||
# Sort a row's columns based on their real order in the table, and remove
|
||||
# generated columns.
|
||||
# This requires that the optional tbl_struct arg was passed to <new()>.
|
||||
# If not, the rows are sorted alphabetically.
|
||||
#
|
||||
@@ -476,6 +477,7 @@ sub sort_cols {
|
||||
my @cols;
|
||||
if ( $self->{tbl_struct} ) {
|
||||
my $pos = $self->{tbl_struct}->{col_posn};
|
||||
my $is_generated = $self->{tbl_struct}->{is_generated};
|
||||
my @not_in_tbl;
|
||||
@cols = sort {
|
||||
$pos->{$a} <=> $pos->{$b}
|
||||
@@ -489,6 +491,9 @@ sub sort_cols {
|
||||
1;
|
||||
}
|
||||
}
|
||||
grep {
|
||||
!$is_generated->{$_}
|
||||
}
|
||||
sort keys %$row;
|
||||
push @cols, @not_in_tbl if @not_in_tbl;
|
||||
}
|
||||
|
Reference in New Issue
Block a user