Fix for 930693: ChangeHandler and text columns with just whitespace

This commit is contained in:
Brian Fraser
2012-08-16 14:07:58 -03:00
parent 1481494ef1
commit 9a788e16df
4 changed files with 8 additions and 5 deletions

View File

@@ -488,7 +488,10 @@ sub make_fetch_back_query {
my $col = $_;
if ( $self->{hex_blob}
&& $tbl_struct->{type_for}->{$col} =~ m/blob|text|binary/ ) {
$col = "IF(`$col`='', '', CONCAT('0x', HEX(`$col`))) AS `$col`";
# Here we cast to binary, as otherwise, since text columns are
# space padded, MySQL would compare ' ' and '' to be the same.
# See https://bugs.launchpad.net/percona-toolkit/+bug/930693
$col = "IF(BINARY(`$col`)='', '', CONCAT('0x', HEX(`$col`))) AS `$col`";
}
else {
$col = "`$col`";