Backport of
- revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461 - revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866 BUG#35274 - merge table doesn't need any base tables, gives error 124 when key accessed SELECT queries that use index against a merge table with empty underlying tables list may return with error "Got error 124 from storage engine". The problem was that wrong error being returned. mysql-test/r/merge.result: Backport of - revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461 - revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866 A test case for BUG#35274. Modified a test case according to fix for BUG#35274. Key based reads are now allowed for merge tables with no underlying tables defined. mysql-test/t/merge.test: Backport of - revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461 - revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866 A test case for BUG#35274. Modified a test case according to fix for BUG#35274. Key based reads are now allowed for merge tables with no underlying tables defined. storage/myisammrg/myrg_queue.c: Backport of - revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461 - revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866 Return "end of file" error instead of "wrong index" error when we got a merge table with empty underlying tables list. In 5.1 we cannot rely on info->open_tables value when checking if a merge table has no underlying tables defined. Use info->tables instead.
This commit is contained in:
parent
fefbd756db
commit
fe5bcb475c
@ -277,7 +277,7 @@ t3 CREATE TABLE `t3` (
|
||||
drop table t3,t2,t1;
|
||||
create table t1 (a int not null, key(a)) engine=merge;
|
||||
select * from t1;
|
||||
ERROR HY000: Got error 124 from storage engine
|
||||
a
|
||||
drop table t1;
|
||||
create table t1 (a int not null, b int not null, key(a,b));
|
||||
create table t2 (a int not null, b int not null, key(a,b));
|
||||
@ -988,6 +988,11 @@ m1 CREATE TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1, m1;
|
||||
CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
|
||||
SELECT MAX(a) FROM t1;
|
||||
MAX(a)
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT);
|
||||
CREATE TABLE t2(a VARCHAR(10));
|
||||
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2);
|
||||
|
@ -126,7 +126,6 @@ drop table t3,t2,t1;
|
||||
# Test table without unions
|
||||
#
|
||||
create table t1 (a int not null, key(a)) engine=merge;
|
||||
--error 1030
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
@ -615,6 +614,14 @@ ALTER TABLE m1 UNION=();
|
||||
SHOW CREATE TABLE m1;
|
||||
DROP TABLE t1, m1;
|
||||
|
||||
#
|
||||
# BUG#35274 - merge table doesn't need any base tables, gives error 124 when
|
||||
# key accessed
|
||||
#
|
||||
CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
|
||||
SELECT MAX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# BUG#32047 - 'Spurious' errors while opening MERGE tables
|
||||
#
|
||||
|
@ -65,7 +65,17 @@ int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag)
|
||||
}
|
||||
}
|
||||
else
|
||||
my_errno= error= HA_ERR_WRONG_INDEX;
|
||||
{
|
||||
/*
|
||||
inx may be bigger than info->keys if there are no underlying tables
|
||||
defined. In this case we should return empty result. As we check for
|
||||
underlying tables conformance when we open a table, we may not enter
|
||||
this branch with underlying table that has less keys than merge table
|
||||
have.
|
||||
*/
|
||||
DBUG_ASSERT(!info->tables);
|
||||
error= my_errno= HA_ERR_END_OF_FILE;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user