Bug #90846 mysqldump syntax error with histogram buckets

Submitted: 12 May 2018 11:34 Modified: 8 Jun 2018 15:25
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:8.0.11 OS:Any
Assigned to: CPU Architecture:Any

[12 May 2018 11:34] Shane Bester
Description:
mysqldump outputs query with syntax error. see this:

/*!80002 ANALYZE TABLE `t` UPDATE HISTOGRAM ON `a` WITH 10 BUCKETS; */;

How to repeat:
drop table if exists t;
create table t(a int,key(a))engine=innodb;
analyze table t update histogram on a with 10 buckets;
show create table t;

mysqldump -uroot test

Suggested fix:
remove the ; inside the version comment.
[14 May 2018 17:27] Shane Bester
In case it wasn't clear what the bug is,  this is it :

E:\mysql-8.0.11-winx64\bin>mysqldump -uroot test t > t.sql

E:\mysql-8.0.11-winx64\bin>mysql -uroot test < t.sql
ERROR 1064 (42000) at line 39: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

E:\mysql-8.0.11-winx64\bin>
[14 May 2018 17:28] Shane Bester
mysql> /*!80002 ANALYZE TABLE `t` UPDATE HISTOGRAM ON `a` WITH 10 BUCKETS; */;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*/' at line 1
mysql>
[14 May 2018 17:29] Shane Bester
removing the rogue semicolon:

mysql> /*!80002 ANALYZE TABLE `t` UPDATE HISTOGRAM ON `a` WITH 10 BUCKETS */;
+--------+-----------+----------+----------------------------------------------+
| Table  | Op        | Msg_type | Msg_text                                     |
+--------+-----------+----------+----------------------------------------------+
| test.t | histogram | status   | Histogram statistics created for column 'a'. |
+--------+-----------+----------+----------------------------------------------+
1 row in set (0.10 sec)
[8 Jun 2018 15:25] Paul DuBois
Posted by developer:
 
Fixed in 8.0.13.

ANALYZE TABLE ... UPDATE HISTOGRAM statements produced by mysqldump
contained a syntax error.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.