| 1 |
# |
| 2 |
# This test simulates an error in an aria file discovered during a recursive SQL call. |
| 3 |
# The error handling causes used join structures to be deleted, which caused crashes in |
| 4 |
# upper levels when trying to access structures that does not exist anymore |
| 5 |
# |
| 6 |
|
| 7 |
--source include/have_debug_sync.inc |
| 8 |
--source include/not_embedded.inc |
| 9 |
|
| 10 |
set @save_big_tables=@@big_tables; |
| 11 |
set big_tables=1; |
| 12 |
|
| 13 |
create table folks(id int, name char(32), dob date, father int, mother int); |
| 14 |
|
| 15 |
insert into folks values |
| 16 |
(100, 'Me', '2000-01-01', 20, 30), |
| 17 |
(20, 'Dad', '1970-02-02', 10, 9), |
| 18 |
(30, 'Mom', '1975-03-03', 8, 7), |
| 19 |
(10, 'Grandpa Bill', '1940-04-05', null, null), |
| 20 |
(9, 'Grandma Ann', '1941-10-15', null, null), |
| 21 |
(25, 'Uncle Jim', '1968-11-18', 8, 7), |
| 22 |
(98, 'Sister Amy', '2001-06-20', 20, 30), |
| 23 |
(7, 'Grandma Sally', '1943-08-23', null, 6), |
| 24 |
(8, 'Grandpa Ben', '1940-10-21', null, null), |
| 25 |
(6, 'Grandgrandma Martha', '1923-05-17', null, null), |
| 26 |
(67, 'Cousin Eddie', '1992-02-28', 25, 27), |
| 27 |
(27, 'Auntie Melinda', '1971-03-29', null, null); |
| 28 |
|
| 29 |
|
| 30 |
call mtr.add_suppression(".*marked as crashed.*"); |
| 31 |
SET @saved_dbug= @@SESSION.debug_dbug; |
| 32 |
SET SESSION debug_dbug="+d,ha_rnd_next_error"; |
| 33 |
SET @ha_rnd_next_error_counter=110; |
| 34 |
|
| 35 |
let q= |
| 36 |
with recursive |
| 37 |
ancestor_couples(h_id, h_name, h_dob, h_father, h_mother, |
| 38 |
w_id, w_name, w_dob, w_father, w_mother) |
| 39 |
as |
| 40 |
( |
| 41 |
select h.*, w.* |
| 42 |
from folks h, folks w, coupled_ancestors a |
| 43 |
where a.father = h.id AND a.mother = w.id |
| 44 |
union |
| 45 |
select h.*, w.* |
| 46 |
from folks v, folks h, folks w |
| 47 |
where v.name = 'Me' and |
| 48 |
(v.father = h.id AND v.mother= w.id) |
| 49 |
), |
| 50 |
coupled_ancestors (id, name, dob, father, mother) |
| 51 |
as |
| 52 |
( |
| 53 |
select h_id, h_name, h_dob, h_father, h_mother |
| 54 |
from ancestor_couples |
| 55 |
union |
| 56 |
select w_id, w_name, w_dob, w_father, w_mother |
| 57 |
from ancestor_couples |
| 58 |
) |
| 59 |
select h_name, h_dob, w_name, w_dob |
| 60 |
from ancestor_couples; |
| 61 |
|
| 62 |
--error ER_CRASHED_ON_USAGE |
| 63 |
eval $q; |
| 64 |
drop table folks; |
| 65 |
|
| 66 |
set big_tables=@save_big_tables; |
| 67 |
SET @@SESSION.debug_dbug=@saved_dbug; |