mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 05:29:30 +00:00
Quote chunk col in char chunk sql.
This commit is contained in:
@@ -26,7 +26,7 @@ if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
else {
|
||||
plan tests => 91;
|
||||
plan tests => 93;
|
||||
}
|
||||
|
||||
$sb->create_dbs($dbh, ['test']);
|
||||
@@ -1202,7 +1202,7 @@ is(
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Issue Bug #897758: TableChunker dies from an uninit value
|
||||
# Bug #897758: TableChunker dies from an uninit value
|
||||
# #############################################################################
|
||||
|
||||
@chunks = $c->calculate_chunks(
|
||||
@@ -1310,6 +1310,49 @@ is(
|
||||
# %params,
|
||||
#);
|
||||
|
||||
# #############################################################################
|
||||
# Bug 967451: Char chunking doesn't quote column name
|
||||
# #############################################################################
|
||||
$sb->load_file('master', "t/lib/samples/char-chunking/ascii.sql", 'test');
|
||||
$dbh->do("ALTER TABLE test.ascii CHANGE COLUMN c `key` char(64) NOT NULL");
|
||||
$t = $tp->parse( $tp->get_create_table($dbh, 'test', 'ascii') );
|
||||
|
||||
%params = $c->get_range_statistics(
|
||||
dbh => $dbh,
|
||||
db => 'test',
|
||||
tbl => 'ascii',
|
||||
chunk_col => 'key',
|
||||
tbl_struct => $t,
|
||||
);
|
||||
is_deeply(
|
||||
\%params,
|
||||
{
|
||||
min => '',
|
||||
max => 'ZESUS!!!',
|
||||
rows_in_range => '142',
|
||||
},
|
||||
"Range stats for `key` col (bug 967451)"
|
||||
);
|
||||
|
||||
@chunks = $c->calculate_chunks(
|
||||
dbh => $dbh,
|
||||
db => 'test',
|
||||
tbl => 'ascii',
|
||||
tbl_struct => $t,
|
||||
chunk_col => 'key',
|
||||
chunk_size => '50',
|
||||
%params,
|
||||
);
|
||||
is_deeply(
|
||||
\@chunks,
|
||||
[
|
||||
"`key` < '5'",
|
||||
"`key` >= '5' AND `key` < 'I'",
|
||||
"`key` >= 'I'",
|
||||
],
|
||||
"Caclulate chunks for `key` col (bug 967451)"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
Reference in New Issue
Block a user