mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-19 17:04:00 +00:00
PT-1860 make pt-osc respect case insesitive lookup on Windows and osx
This commit is contained in:
@@ -325,11 +325,33 @@ sub check_table {
|
||||
}
|
||||
my ($dbh, $db, $tbl) = @args{@required_args};
|
||||
my $q = $self->{Quoter} || 'Quoter';
|
||||
$self->{check_table_error} = undef;
|
||||
|
||||
# https://dev.mysql.com/doc/refman/8.0/en/identifier-case-sensitivity.html
|
||||
# MySQL may use use case-insensitive table lookup, this is controller by
|
||||
# @@lower_case_table_names. 0 means case sensitive search, 1 or 2 means
|
||||
# case insensitive lookup.
|
||||
|
||||
my $lctn_sql = 'SELECT @@lower_case_table_names';
|
||||
PTDEBUG && _d($lctn_sql);
|
||||
|
||||
my $lower_case_table_names;
|
||||
eval { ($lower_case_table_names) = $dbh->selectrow_array($lctn_sql); };
|
||||
if ( my $e = $EVAL_ERROR ) {
|
||||
PTDEBUG && _d($e);
|
||||
$self->{check_table_error} = $e;
|
||||
return 0;
|
||||
}
|
||||
|
||||
PTDEBUG && _d("lower_case_table_names=$lower_case_table_names");
|
||||
if ($lower_case_table_names > 0) {
|
||||
PTDEBUG && _d("MySQL uses case-insensitive lookup, converting '$tbl' to lowercase");
|
||||
$tbl = lc $tbl;
|
||||
}
|
||||
|
||||
my $db_tbl = $q->quote($db, $tbl);
|
||||
PTDEBUG && _d('Checking', $db_tbl);
|
||||
|
||||
$self->{check_table_error} = undef;
|
||||
|
||||
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
||||
. ' LIKE ' . $q->literal_like($tbl);
|
||||
PTDEBUG && _d($sql);
|
||||
|
Reference in New Issue
Block a user