Bug #106623 Incorrect multi-index hint example

Submitted: 2 Mar 2022 22:01 Modified: 3 Mar 2022 22:17
Reporter: Matt Lord Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: Jon Stephens CPU Architecture:Any

[2 Mar 2022 22:01] Matt Lord
Description:
The second to last example on this page uses an invalid syntax:
https://dev.mysql.com/doc/refman/8.0/en/index-hints.html :

mysql> SELECT * FROM t
    ->   USE INDEX (index1)
    ->   IGNORE INDEX (index1) FOR ORDER BY
    ->   IGNORE INDEX (index1) FOR GROUP BY;
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 'ORDER BY
  IGNORE INDEX (index1) FOR GROUP BY' at line 3

The index should come after the FOR clause (it is in other examples).

How to repeat:
mysql> create table t (id int primary key, ic varchar(100), key `index1` (ic));
Query OK, 0 rows affected (0.01 sec)

mysql> SELECT * FROM t   USE INDEX (index1)   IGNORE INDEX (index1) FOR ORDER BY   IGNORE INDEX (index1) FOR GROUP BY;
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 'ORDER BY   IGNORE INDEX (index1) FOR GROUP BY' at line 1

mysql> SELECT * FROM t   USE INDEX (index1)   IGNORE INDEX FOR ORDER BY (index1)   IGNORE INDEX FOR GROUP BY (index1);
Empty set (0.00 sec)

Suggested fix:
I think you can guess. :-D
[3 Mar 2022 4:59] MySQL Verification Team
Hello Matt,

Thank you for the bug report.

Sincerely,
Umesh
[3 Mar 2022 22:17] Jon Stephens
Hi, Matt! Thanks for spotting this.

Fixed in the 5.6, 5.7, 8.0 editions of the Manual, in mysqldoc rev 72167.

Closed.

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

Page generated in 0.052 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.