Commit d7e7f48e authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-27407 Different ASC/DESC index attributes on MERGE and underlying table...

MDEV-27407 Different ASC/DESC index attributes on MERGE and underlying table can cause wrong results

detect if merge children are "differently defined" regarding ASC/DESC
parent 58195449
...@@ -3904,3 +3904,14 @@ set global default_storage_engine=@save_default_storage_engine; ...@@ -3904,3 +3904,14 @@ set global default_storage_engine=@save_default_storage_engine;
# #
# End of 10.0 tests # End of 10.0 tests
# #
#
# MDEV-27407 Different ASC/DESC index attributes on MERGE and underlying table can cause wrong results
#
create table t (a int, key(a desc)) engine=myisam;
create table tm (a int, key(a)) engine=merge union(t);
select * from tm;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
drop table tm, t;
#
# End of 10.8 tests
#
...@@ -2862,3 +2862,16 @@ set global default_storage_engine=@save_default_storage_engine; ...@@ -2862,3 +2862,16 @@ set global default_storage_engine=@save_default_storage_engine;
--echo # --echo #
--echo # End of 10.0 tests --echo # End of 10.0 tests
--echo # --echo #
--echo #
--echo # MDEV-27407 Different ASC/DESC index attributes on MERGE and underlying table can cause wrong results
--echo #
create table t (a int, key(a desc)) engine=myisam;
create table tm (a int, key(a)) engine=merge union(t);
--error ER_WRONG_MRG_TABLE
select * from tm;
drop table tm, t;
--echo #
--echo # End of 10.8 tests
--echo #
...@@ -554,7 +554,8 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo, ...@@ -554,7 +554,8 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
t1_keysegs_j__type != t2_keysegs[j].type || t1_keysegs_j__type != t2_keysegs[j].type ||
t1_keysegs[j].null_bit != t2_keysegs[j].null_bit || t1_keysegs[j].null_bit != t2_keysegs[j].null_bit ||
t1_keysegs[j].length != t2_keysegs[j].length || t1_keysegs[j].length != t2_keysegs[j].length ||
t1_keysegs[j].start != t2_keysegs[j].start) t1_keysegs[j].start != t2_keysegs[j].start ||
(t1_keysegs[j].flag ^ t2_keysegs[j].flag) & HA_REVERSE_SORT)
{ {
DBUG_PRINT("error", ("Key segment %d (key %d) has different " DBUG_PRINT("error", ("Key segment %d (key %d) has different "
"definition", j, i)); "definition", j, i));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment