Merge branch '3.0' into PT-1554-more-MySQL8-tests

This commit is contained in:
Carlos Salguero
2018-06-14 14:37:35 -03:00
4 changed files with 87 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
Changelog for Percona Toolkit
* Fixed bug PT-1570 : pt-archiver fails to detect columns with the word GENERATED as part of the comment
* Improvement PT-1569 : Disabled --alter-foreign-keys-method=drop_swap in pt-osc
* Fixed bug PT-1563 : Fixed pt-show-grants for MySQL 5.6
* Improvement PT-1562 : pt-mysql-summary: Fix mysqld command for Travis

View File

@@ -220,7 +220,7 @@ sub remove_quoted_text {
my ($string) = @_;
$string =~ s/[^\\]`[^`]*[^\\]`//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
$string =~ s/[^\\]"[^"]*[^\\]"//g;
$string =~ s/[^\\]'[^']*[^\\]'//g;
return $string;
}

View File

@@ -1188,6 +1188,85 @@ SKIP: {
) or die Data::Dumper::Dumper($tbl);
}
# Test that the GENERATED word in a column comment doesn't make that column
# to be detected as a MySQL 5.7+ generated column.
$tbl = $tp->parse( load_file('t/lib/samples/generated_cols_comments.sql') );
is_deeply(
$tbl,
{
charset => 'latin1',
clustered_key => 'PRIMARY',
col_posn => {
id => 0,
source => 1,
tso_id => 2
},
cols => [
'id',
'source',
'tso_id'
],
defs => {
id => ' `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT \'The unique id of the audit record.\'',
source => ' `source` enum(\'val1\',\'val2\') NOT NULL COMMENT \'Transaction originator\'',
tso_id => ' `tso_id` int(11) unsigned NOT NULL DEFAULT \'0\' COMMENT \'An internally generated transaction.\''
},
engine => 'InnoDB',
is_autoinc => {
id => 1,
source => 0,
tso_id => 0
},
is_col => {
id => 1,
source => 1,
tso_id => 1
},
is_generated => {},
is_nullable => {},
is_numeric => {
id => 1,
tso_id => 1
},
keys => {
PRIMARY => {
col_prefixes => [
undef
],
colnames => '`id`',
cols => [
'id'
],
ddl => 'PRIMARY KEY (`id`),',
is_col => {
id => 1
},
is_nullable => 0,
is_unique => 1,
name => 'PRIMARY',
type => 'BTREE'
}
},
name => 't1',
non_generated_cols => [
'id',
'source',
'tso_id'
],
null_cols => [],
numeric_cols => [
'id',
'tso_id'
],
type_for => {
id => 'int',
source => 'enum',
tso_id => 'int'
}
},
'Column having the word "generated" as part of the comment is OK',
) or diag Data::Dumper::Dumper($tbl);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -0,0 +1,6 @@
CREATE TABLE `t1` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'The unique id of the audit record.',
`source` enum('val1','val2') NOT NULL COMMENT 'Transaction originator',
`tso_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'An internally generated transaction.',
PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='some comment here generated'