[MDEV-3978] Query: DELETE FROM .. ORDER BY .. LIMIT 1 failed: 1030 Got error 124 "Wrong index given to function" from storage engine Created: 2012-12-24  Updated: 2015-01-28  Resolved: 2014-11-09

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Delete, Partitioning
Affects Version/s: 10.0.0, 5.5.28a
Fix Version/s: 5.5.35, 10.0.8

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: upstream-fixed

Issue Links:
Relates
relates to MDEV-7059 Add test case for MDEV-3978 / MySQL#6... Open

 Description   

The problem also exists on MySQL 5.5/5.6 and filed as http://bugs.mysql.com/bug.php?id=67982

--source include/have_partition.inc
 
CREATE TABLE IF NOT EXISTS t1 ( a INT, b INT, KEY(b) )
ENGINE = MYISAM PARTITION BY LIST (a) (
  PARTITION p0 VALUES IN (1, NULL),
  PARTITION p1 VALUES IN (4, 6, 3),
  PARTITION p2 VALUES IN (8, 2, 5)
);
INSERT INTO t1 VALUES (5,0), (6,3), (4,9), (8,4);
ALTER TABLE t1 DISABLE KEYS;
ALTER TABLE t1 REBUILD PARTITION p1;
DELETE FROM t1 WHERE a = 8 ORDER BY b, a LIMIT 1;

bug.mdev3978-4                           [ fail ]
        Test ended at 2012-12-28 03:48:24
 
CURRENT_TEST: bug.mdev3978-4
mysqltest: At line 12: query 'DELETE FROM t1 WHERE a = 8 ORDER BY b, a LIMIT 1' failed: 1030: Got error 124 "Wrong index given to function" from storage engine

revision-id: monty@askmonty.org-20121217203456-gjlhf7eslleda9rz
date: 2012-12-17 22:34:56 +0200
revno: 3597
branch: maria/5.5

Also reproducible on 10.0-base and on last release versions 5.5.28a and 10.0.0.
Not reproducible on MariaDB 5.3 or MySQL 5.1.



 Comments   
Comment by Elena Stepanova [ 2014-11-09 ]

Upstream bug fixed in MySQL 5.5.35, 5.6.15, 5.7.3.
Both MariaDB 5.5 and 10.0 also have the fix, apparently through the merge of MySQL 5.5.

revno: 4522
revision-id: aditya.a@oracle.com-20131021063702-ak3uppt7h8a0czun
parent: mattias.jonsson@oracle.com-20131019132951-3ah7cc1jcb32bu98
committer: Aditya A <aditya.a@oracle.com>
branch nick: mysql-5.5
timestamp: Mon 2013-10-21 12:07:02 +0530
message:
  Bug #16051817  GOT ERROR 124 FROM STORAGE ENGINE 
                 ON DELETE FROM A PARTITIONED TABLE
  
  PROBLEM
  -------
  
  The user first disables all the non unique indexes
  in the table and then rebuilds one partition.
  During rebuild the indexes on that particular
  partition are enabled. Now when we give a query 
  the optimizer is unaware that on one partition 
  indexes are enabled and if the optimizer selects
  that index,myisam thinks that the index is not 
  active and gives an error.
  
  FIX
  ---
  
  Before rebuilding a partition check whether non
  unique indexes are disabled on the partitons.
  If they are disabled then after rebuild disable
  the index on the partition. 
  
  [Approved by Mattiasj #rb3469]

Generated at Thu Feb 08 06:52:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.