Skip to content

Commit ece5671

Browse files
committed
Escape identifiers in table column metrics
Otherwise some queries may fail if reserved words were used as field, table or database names.
1 parent 42a9586 commit ece5671

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mysqltuner.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -5994,7 +5994,7 @@ sub mysql_tables {
59945994
my $current_type =
59955995
uc($ctype) . ( $isnull eq 'NO' ? " NOT NULL" : "" );
59965996
my $optimal_type = select_str_g( "Optimal_fieldtype",
5997-
"SELECT $_ FROM $dbname.$tbname PROCEDURE ANALYSE(100000)"
5997+
"SELECT \\`$_\\` FROM \\`$dbname\\`.\\`$tbname\\` PROCEDURE ANALYSE(100000)"
59985998
);
59995999
if ( not defined($optimal_type) or $optimal_type eq '' ) {
60006000
infoprint " Current Fieldtype: $current_type";
@@ -6006,7 +6006,7 @@ sub mysql_tables {
60066006
badprint
60076007
"Consider changing type for column $_ in table $dbname.$tbname";
60086008
push( @generalrec,
6009-
"ALTER TABLE $dbname.$tbname MODIFY $_ $optimal_type;"
6009+
"ALTER TABLE \`$dbname\`.\`$tbname\` MODIFY \`$_\` $optimal_type;"
60106010
);
60116011

60126012
}

0 commit comments

Comments
 (0)