Bug #17873 Error message for FORCE INDEX () with wrong parameter(s) is Incorrect
Submitted: 2 Mar 2006 19:01 Modified: 15 Jun 2006 4:20
Reporter: Chris Calender Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:All Versions OS:Any (All)
Assigned to: Igor Babaev CPU Architecture:Any

[2 Mar 2006 19:01] Chris Calender
Description:
If you use FORCE INDEX () in a SELECT and give it a wrong parameter (i.e., a column name rather than an index name), it gives an error message of:

ERROR 1072 (42000): Key column 'a' doesn't exist in table

When in fact, 'a' does exist and it is a key column (as you can see fromthe following example).

How to repeat:
CREATE TABLE t1 ( a INT PRIMARY KEY );
SELECT * FROM t1 FORCE INDEX (a);
[28 May 2006 6:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/6936
[30 May 2006 7:09] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/7003
[13 Jun 2006 5:28] Igor Babaev
ChangeSet
  1.2490 06/05/30 00:08:58 igor@rurik.mysql.com +33 -0
  Fixed bug #17873: confusing error message when IGNORE/USE/FORCE INDEX
  refers to a column name.

Fix will appear in 4.1.21, 5.0.23, 5.1.11
[15 Jun 2006 4:16] Paul Dubois
Noted in 4.1.21, 5.0.23, 5.1.12 changelogs.

For a reference to a non-existent index in FORCE INDEX, the error
message referred to a column, not an index.