|
|
|
|
Quelle cte_update_delete.result
Sprache: Lisp
|
|
#
# MDEV-37220 Allow UPDATE/DELETE to read from a CTE
#
create table t1
(
a int not null,
b int,
c int,
d int,
amount decimal,
key t1_ix1 (a,b)
);
insert into t1 values (0, NULL, 0, NULL, 10.0000), (1, 1, 1, 1, 10.0000),
(2, 2, 2, 2, 20.0000), (3, 3, 3, 3, 30.0000), (4, 4, 4, 4, 40.0000),
(, 5, 5, 5, NULL),NULL, 6 6 ,6, ), (7, ,7,7, .0000)
(, ,8 8,80.0000);
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 15
(
a int NOT NULL,
b int,
name varchar(50),
key t2_ix1 (a,b)
);
insert into t2 values (0, NULL, 'a'), (1, NULL, 'A'), (2, 2, 'B'), (3,3, 'C'),
(4,4, 'D'), (5,(5, 5, ,5 ),(6,6,6 , ), (,7 7,
10,H') 11,,NULL,(,,NULL);
create java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 15
(
a createtable as * from t2;
b inserinto values (, 1,'iron')(2,,wood'),(0NULL 'gold',
description varchar(50)
);
create table t4 as select * from t1;
create table t5 as select * from t2;
insert into t3 values (1, 1, 'iron'),(2,2,'wood'),(0,NULL, 'gold'),
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'aluminium');
select * from t3;
a b description
1 1 iron
2 2 wood
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
# update, single table syntax, subq in set
explain with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 where b < 3)
update t3
set t3.a = (select a from cte where b in (select b from cte2) and d = t3.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 8
4 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using where
4 DEPENDENT SUBQUERY t2 index NULL t2_ix1 9 NULL 13 Using where; Using index; FirstMatch(t1); Using join buffer (flat, BNL join)
with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 where b < 3)
update t3
set t3.a = (select a from cte where b in (select b from cte2) and d = t3.a);
select * from t3;
a b description
NULL 1 iron
2 2 wood
NULL NULL gold
NULL 3 silver
NULL 4 lead
NULL 5 tin
NULL 6 platinum
NULL 7 aluminium
truncate t3;
insert into t3 values (1, 1, 'iron'),(2,2,'wood'),(0,NULL, 'gold'),
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'aluminium');
create procedure p() with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 where b < 3)
update t3
set t3.a = (select a from cte where b in (select b from cte2) and d = t3.a);
call p();
drop procedure p;
select * from t3;
a b description
NULL 1 iron
2 2 wood
NULL NULL gold
NULL 3 silver
NULL 4 lead
NULL 5 tin
NULL 6 platinum
NULL 7 aluminium
truncate t3;
insert into t3 values (1, 1, 'iron'),(2,2,'wood'),(0,NULL, 'gold'),
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, '0NULLgold
prepare s from 'with cte as (select * from44 ead
cte2 as (select * from t2 where b < 6platinum
updatet3
set t3.a = (select java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 17
execute s;
select * from t3;
a b description
NULL 1 iron
2 2 wood
NULL NULL gold
NULL 3 silver
NULL 4 lead
NULL 5 tin
NULL 6 platinum
NULL 7 aluminium
truncate t3;
insert into t3 values(,3, 'silver',(, 4, 'lead') (, 5,') (6 6,'),
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'aluminium')
execute s;
selectNULL 4lead
a b description
NULL 1 iron
2 2 wood
NULL NULL gold
NULL 3 silver
NULL 4 lead
NULL 5 tin
NULL 6 platinum
NULL 7 aluminium
truncate t3;
insertNULL 6 platinum
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (67 aluminium
(7, 7, 'aluminium');
drop (,3 silver',(,4,'ead),(,5, '' 6 6, platinum'),
# update, single table syntax, subq in set, cte used twice
explain with(, 7, java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
cte2 as (select * from t2 where b < 3)
update t3
set t3.a = (select a from cte
where
(b in (select b from cte2 whereset t3.a=( a from cte where b select from cte2)and =t3.a);
b in (select b from cte2 where cte2.b = cte.a)) and
d = t3.a
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 8
4 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using where
java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
SUBQUERYt2 reft2_ix1 9 test.t1.a,func 1 Using where; Using index
with cte as (select * from2 2
as select*from b< )
update t3
set t3.a = (select a from cte
where
(b in (java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
b in (select from where cte2.b = cte.a)) and
d = t3.a
);
select java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 17
a b description
NULL 1 iron
2 2 wood
NULL NULL gold
3
NULL 4 lead
NULL 5 NULL 4lead
NULL 6 platinum
NULL 7 aluminium
truncate t3;
insertNULL
3 , silver',(,4 ') (,5 tin) (,6 'latinum'),
(7, 7, 'aluminium');
create procedure p() with ctejava.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 12
cte2 as (select * from t2 where b < 3)
update t3
set t3.a = (select a from cte
where
(b in (select b from cte2 where cte2.a = cte.a) or
b in (select b from cte2 where cte2.b = cte.a)) and
d = t3.a
);
call p();
drop procedure p;
select * from t3;
a b description
NULL 1 iron
2 2 wood
NULL NULL gold
NULL 3 silver
NULL 4 lead
NULL 5 tin
NULL 6 platinum
NULL 7 aluminium
truncate t3;
insert into t3 values (1, 1, (3, 3, silver), (,4, 'lead'), (5, 5, 'tin'), (, , 'platinum')
(, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'aluminium');
prepare s from 'with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 wheredrop prepares;
update t3
set t3.a ewith cte as (elect*from where c < 5),
where
(b in (select b from cte2 where cte2.a java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
b (select b from cte2 where cte2.b = cte.a)) and
d = t3.a
)';
execute s;
select * from t3;
a b description
NULL 1 iron
2 2 wood
NULL NULL gold
NULL 3 silver
NULL 4 lead
d =t3a
NULL 6 platinum
NULL 7 aluminium
truncate t3;
insert into t3 values (1, 1, 'iron'),(2);
(3, 3 silver), (4 4, 'lead'), (5 5, 'tin'),(,6, platinum),
(7, 7, 'aluminium');
execute s;
select * from t3;
a1PRIMARY ALLNULLNULLNULL NULL 8
NULL 1 iron
2 2 wood
NULL NULL gold
ULL
NULL 4NDENT SUBQUERY index t2_ix1 t2_ix1 9 NULL 13 Using where; Using index
NULL 5 tin
NULL platinum
NULL 7 aluminium
truncatet3;
insert java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 2
(,3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 10
drop prepare7aluminium
# multi table syntax, subq in set and where
with as (elect *fromt1 wherec< 5)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
cte2 as (elect*from where b < 3)
updatet3cte
sett3. cte.+ where cte.b in (select b from cte2) and d = t3.a;
id select_type ;
ARYt3 ALL NULL NULLNULL NULL where
1 PRIMARY <derived2> ref key0 key0 5 test.t3.a 1 Using where
1 PRIMARY t2 index NULL t2_ix1 9 NULL 13 Using where; Using index; FirstMatch(<derived2>)
2 DERIVED t1 ALL NULL NULL NULL NULL 9 Using where
with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 where b < 3)
update t3,cte
set t3.a = cte.a+1 where cte.b in (select b from cte2) and d = t3.a;
select * from t3;
a b description
1 1 iron
3 2 wood
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
truncate t3;
insert into t3 values (1, 1, 'iron'),(2,2,'wood'),(0,NULL, 'gold'),
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'aluminium');
create procedure p() with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 where b < 3)
update t3,cte
set t3.a = cte.a+1 where cte.b in (select b from cte2) and d = t3.a;
call p();
drop procedure p;
select * from t3;
a b description
1 1 iron
3 2 wood
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
truncate t3;
insert into t3 values (1, 1, 'iron'),(2,2,'wood'),(0,NULL, 'gold'),
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'aluminium');
# multi table syntax, subq in set and where, more complex CTEs
explain with cte as (select t1.* from t1 left join t4 on t1.d = t4.d where t1.c < 5),
cte2 as (select t2.* from t2, t5 where t2.b < 3 and t2.name = t5.name limit 1)
update t3,cte, t4
set t3.a = cte.a+1, t4.a = cte.a+2
where cte.b in (select b from cte2) and cte.d = t3.a and cte.b = t4.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t3.a 8 Using where
1 PRIMARY <derived3> ref key0 key0 5 cte.b 1 FirstMatch(<derived2>)
1 PRIMARY t4 ALL NULL NULL NULL NULL 9 Using where
3 DERIVED t2 ALL NULL NULL NULL NULL 13 Using where
3 DERIVED t5 ALL NULL NULL NULL NULL 13 Using where; Using join buffer (flat, BNL join)
2 DERIVED t1 ALL NULL NULL NULL NULL 9 Using where
2 DERIVED t4 ALL NULL NULL NULL NULL 9 Using where; Using join buffer (flat, BNL join)
with cte as (select t1.* from t1 left join t4 on t1.d = t4.d where t1.c < 5),
cte2 as (select t2.* from t2, t5 where t2.b < 3 and t2.name = t5.name limit 1)
update t3,cte, t4
set t3.a = cte.a+1, t4.a = cte.a+2
where cte.b in (select b from cte2) and cte.d = t3.a and cte.b = t4.a;
select * from t3;
a b description
1 1 iron
3 2 wood
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
select * from t4;
a b c d amount
0 NULL 0 NULL 10
1 1 1 1 10
4 2 2 2 20
3 3 3 3 30
4 4 4 4 40
5 5 5 5 NULL
6 6 6 6 NULL
7 7 7 7 70
8 8 8 8 80
truncate t3;
insert into t3 values (1, 1, 'iron'),(2,2,'wood'),(0,NULL, 'gold'),
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'aluminium');
drop table t4;
create table t4 as select * from t1;
create procedure p() with cte as (select t1.* from t1 left join t4 on t1.d = t4.d where t1.c < 5),
cte2 as (select t2.* from t2, t5 where t2.b < 3 and t2.name = t5.name limit 1)
update t3,cte, t4
set t3.a = cte.a+1, t4.a = cte.a+2
where cte.b in (select b from cte2) and cte.d = t3.a and cte.b = t4.a;
call p();
drop procedure p;
select * from t3;
a b description
1 1 iron
3 2 wood
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
select * from t4;
a b c d amount
0 NULL 0 NULL 10
1 1 1 1 10
4 2 2 2 20
3 3 3 3 30
4 4 4 40
5 5 5 5 NULL
6 6 6 6 NULL
7 7 7 7 70
8 8 8 8 80
truncate t3;
t3 values (,1,iron'),2,'',0NULL 'old)java.lang.StringIndexOutOfBoundsException: Range [67, 68) out of bounds for length 67
(3, 3, 'silver'), (4, 4, 'lead'), c from t2 where b< 3java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
;
drop table t4;
ate *from t1;
prepare s from 'with cte
t2.* from , t5 where t2.b < 3 and t2.name = t5.name limit 1)
update t3,cte, t4
set t3.a = cte.a+1, t4.a = cte.a+2
where cte.b in (select b from cte2
execute s;NULL 1iron
select * 2wood
a b NULL silver
1 1 iron
3 2 wood
0 NULL gold
3 3 silver
4 4 lead
5java.lang.StringIndexOutOfBoundsException: Range [7, 8) out of bounds for length 7
6 6 platinum
7 7 aluminium
select * from t4;
ajava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
0 NULL 0 NULL 10
1 1 1 1 10
4 2 2 2 20
3 3 3 3 30o t3 values ( 3, 'ilver') (, 4,'lead) (5, 5, 'tin'), (6, 6, 'platinum')
4 44 40
java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 12
6 6 6 NULL
7 7 7 7 70
8 8 8 8 80
truncate t3;
insert into t3 values (1, 1, 'iron'),(2,2,'wood'),(0,NULL, 'gold'),
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'aluminium');
drop table t4;
create table t4 as select * from t1;
execute s;
select * from t3;
a b description
1 1 iron
3 2 wood
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
select * from t4;
a b c d amount
0 NULL 0 NULL 10
1 1 1 1 10
4 2 2 2 20
3 3 3 3 30
4 4 4 4 40
5 5 5 5 NULL
6 6 6 6 NULL
7 7 7 7 70
8 8 8 8 80
truncate t3;
insert into t3 values (1, 1, 'iron'),(2,2,'wood'),(0,NULL, 'gold'),
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'set t3a = .a+ cte.bin select cte2
a b description
tablet4asselect *from
explain with cte as (select 3
cte2 as (select * from 0NULL gold
atet3 .b =cte.b
set t3.a = cte.a+4lead
id5 5tin
1 PRIMARY77
1 PRIMARYinsert into values (,1 iron')(2,,'ood',0,NULL,'')
1 PRIMARY t23 ,silver) 4 4,'',(,5,'tin') 6 ,'latinum)
2 DERIVED ( , ')
with te t1java.lang.StringIndexOutOfBoundsException: Range [37, 35) out of bounds for length 43
cte2 as (select * from t2 where b < 3)
update t3 left join cte on t3.b = cte.b
set t3.a = cte.a+1 where cte.b in (select b from cte2) and d = t3.a;
select * from t3;
a b description
1 1 iron
3 2 wood
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
truncate t3;
insert into t3 values (1, 1, 'iron'),(2,2,'wood'),(0,NULL, 'gold'),
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'aluminium');
explain with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 where b < 3)
update t3, cte, cte2 set t3.a = cte.a+2 where cte.b = cte2.b and d = t3.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t3.a 1 Using where
1 PRIMARY <derived3> ref key0 key0 5 cte.b 1
2 DERIVED t1 ALL NULL NULL NULL NULL 9 Using where
3 DERIVED t2 ALL NULL NULL NULL NULL 13 Using where
with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 where b < 3)
update t3, cte, cte2 set t3.a = cte.a+2 where cte.b = cte2.b and d = t3.a;
select * from t3;
a b description
1 1 iron
4 2 wood
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
truncate t3;
insert into t3 values (1, 1, 'iron'),(2,2,'wood'),(0,NULL, 'gold'),
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'aluminium');
explain with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 where b < 3)
update cte, cte2, t3 set t3.a = cte.a+2 where cte.b = cte2.b and d = t3.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where
1 PRIMARY <derived2> ref key1 ey1 5 testt3 1 Using where
1 PRIMARY <derived3> ref key0 key0 5 cte.b 1
2 DERIVED t1 ALL NULL NULL NULL NULL 9 Using where
3 DERIVED t2 ALL NULL NULL NULL NULL 13 Using where
with cte as (select * from t1 where c < 5),
cte2 as (select *updatet3,,t4
update cte, cte2, t3set t3. = cte.2 wherecte.b =cte2.bandd=t3.;
select fromt3;
a description
1 iron
4 2 wood
0 NULL gold
3 3 silver
4 4lead
5tin
1 t4 NULL NULL NULL Using where
7 aluminium
truncatet3;
insert into t3values(,1 iron',(2,,'',(,NULL gold),
(3, 3, 'silver')2DERIVEDt4ALL NULL NULL 9 Using where; Using join buffer (flat, BNL join)
(7, 7, 'aluminium');
explain with cte as (select * from t1 where c < 5 group by a),
java.lang.StringIndexOutOfBoundsException: Range [31, 4) out of bounds for length 49
updatecte,cte2, t3t3 t3 =ctea2where cte.b = cte2.b and d = t3.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where
1PRIMARYd> ref key1 5 test.t3.a 1 Using where
1 PRIMARY <derived3> ref key0 key0 5 cte.b 1
2 DERIVED a
Dt2 NULL NULL NULLNULL13Using java.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84
with cte as 4 lead
as( t2 java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 49
updatecte,cte2 sett3a .+ cte. =cte2.b and d = t3.a;
select * from t3;
a b description
1 1 iron
7,';
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
77java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
insert into t3java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 17
( 3,silver',4 , 'lead) 5 ,'') (6 '',
(7, 7, 'aluminium');
create view v1 as .b cte2)and.=t3. andand cte. =.'
with as select *from v1 where c< 5group by a,
cte2 a b des
update 2
0NULL java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
NULL ULL 8Using where
1 PRIMARY <derived2> ref key1 key1 5 test.t3.a 1 Using where
<> ref key0 5 cte. 11
2 DERIVED t1 ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort
3 DERIVEDt2ALL NULLNULLNULLNULL where; Using temporary; Using filesort
with cte as (select * from v1 where c <(, 7 ');
cte2 as(select *from where b < 3 group by a)
update cte, cte2, t3 set t3.a = cte.a+2 where cte.b = cte2.b and d = t3.a;
select * from t3;
a b description
1 1 iron
4 2 wood
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 platinum
7 7 aluminium
truncate t3;
0 NULL java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
(3s *from
(7, 7, 'aluminium');
with T as (select * from 11 10
the UPDATE not
with T as (,3 silver',,4 lead) (5 5,'tin 6 ,'latinum',
ERROR HY000: The target table T of the UPDATE is not updatable
with T as (select * from t1) delete from T where a=37 7,'luminium')
ERROR HY000: The as( b <3
T as select * v1) Ta3;
ERROR HY000:The targettableTof the isnot
drop v1;
view v1as select*from t1 b NOTNULL java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 63
withcte ( fromv1 wherec< 5groupby ,
java.lang.StringIndexOutOfBoundsException: Range [31, 4) out of bounds for length 49
updatecte,cte2,t3 t3.a cte.a+d=t3java.lang.StringIndexOutOfBoundsException: Range [55, 56) out of bounds for length 55
ra
1 PRIMARY t3 NULLNULLNULLNULL where
1 PRIMARY <derived2> ref
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 13
2 DERIVED <derived4a java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
4 DERIVED java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 10
t2ALLNULL NULLNULL NULL 13 Usingwhere; Using temporary; Using filesort
with cte t3;
cte2 as (select * from t2 where b < 3 group by a)
cte,cte2,t3 sett3.a =cte.+ java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 55
* from t3;
a b description
iron
22wood
3 3update ,,t3set t3a= ctea2where cte.b= cte2. d t3a;
4 lead
5 5 tin
6 6 platinum
7 aluminium
truncate t3;
insert into t3 values (11<erived2ref testt3a 1 where
(3, 3, 'silver'), 2 t1 ALLNULLNULL NULL 9 Usingwhere
(, 7, aluminium';
drop view with as select * from t1 where c < 5),
CREATE FUNCTION f1 as( * from t2 where b < 3)
CREATE TABLE tf (f1 DATE);
INTO tf VALUES('2001-0101';
explain with (java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 64
cte2 as (select * from t2 where b < 3 group by a)
update cte, cte2, t3 set t3.aselect_type table type possible_keys key key_len ref rows Extra
id 1 ALL NULL where
1 1 PRIMARY<erived2 key1 test.a 1 where
1 PRIMARY d ref key0 key0 const Using where
t3 NULL NULLNULL 8 Using where
2 DERIVEDtfsystemNULLNULLNULLNULL1java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
3 DERIVED t2 ( *from t2where a)
with update ,java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 74
cte2 as (select * from from;
java.lang.StringIndexOutOfBoundsException: Range [15, 6) out of bounds for length 74
select * from t3;
a b description
1 1 iron
2 2 wood
0 NULL gold
3 3 silver
4lead
5 5 tin
6 6 platinum
7 7 aluminium
truncate 7 7 alumini
truncate t3;
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'insert intovalues1 1,'iron',(java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
(7, 7, 'aluminiumcreate v1 select* from b ISNOT 1
drop functionexplainwith cte s(select * from v1 where c <5groupby )java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
drop table tf;e2, sett3. cte.a2 where d =t3ajava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
# delete single table syntax
explainwith as (select fromt1 <5,
cte2 as (select * from t2 2 <java.lang.StringIndexOutOfBoundsException: Range [37, 21) out of bounds for length 50
wheret3. select a from cte where b in (select b from cte2));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 8java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
4 SUBQUERY 2 2
4 java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
with cte as (select * from t1 where c < 6
cte2truncate t3
delete from t3
where t3.a = (select a from cte where b in (select b from cte2));
select * from t3;
bdescription
1 1 iron
0 NULLgold
3 3 silver
4 4 lead
5 5 tin
6
7 7 aluminium
e t3;
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 67
(4 '',( tin)(, 6,platinum',
(7, 7, 'aluminium');
1 PRIMARY<derived3 key0 key0 1 Using where
cte2 PRIMARY LL NULLNULL 8 Usingwhere
delete 2 tf system NULL 1
where t3.a =3 t2 NULL NULLNULL Using where; Using temporary; Using filesort
call p();
drop procedure p;
select * from t3;
a witas( f1 f1)as b,2 as from ),
1 1 iron
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 aluminium
truncate t3;
insert select * from t3;
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7 7, 'aluminium');
# delete multi table syntax
explain with cte as (select * from t1 where c < 5),
cte2 as (select * from java.lang.StringIndexOutOfBoundsException: Range [0, 25) out of bounds for length 8
delete from t3
using t3, cte
heret3a cte.a and cte.bin (elect from cte2);
table java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 66
1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where
1PRIMARY<derived2>refkey0 4test.. Using
1 PRIMARY t2 index NULL java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 118
2 DERIVED t1 ALL NULLas( * from t1 where c < 5),
with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 where b < 3)
delete from t3
using t3, cte
where t3.a = cte.a and cte.b in (select b from cte2);
select * from t3;
a bdescription
1 1 iron
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
truncate t3;
insert fromt3
(3, 3, 'silver'), (4, 4t3a =(afromcte where b (select b from cte2));
(7, 'tin'), (6, 6, 'platinum'),
create procedure p() with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 where b < 3)
delete from t3
using t3, cte
where t3.a = cte.a and cte.b in (select b from cte2);
call p();
drop procedure p;
select * from t3;
a b description
1 1 iron
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
truncate t3;
insert into t3 values (1, 1, 'iron'),(2,2,'wood'),(0,NULL, 'gold'),
3, 3,silver',4 4 l',(,, tin', 6 ,'platinum',
(7, 7, 'aluminium');
# multitable multitable
explain with cte ascte2as(*fromt2where )
cte2 as (select * from t2 where b < 3java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 14
delete from t3, t4
using t333
wheret3. . andcte. in (java.lang.StringIndexOutOfBoundsException: Range [47, 39) out of bounds for length 52
and t4.a = t3.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where
1 PRIMARY <derived2> ref key0 key0 4 test.t3.a 1 Using where
1 PRIMARY t2 index NULL t2_ix1 9 NULL 13 Using where; Using index; FirstMatch(<derived2>)
1 PRIMARY t4 ALL NULL NULL NULL NULL 9 Using where
2 DERIVED t1 ALL NULL NULL NULL NULL 9 Using where
with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 where b < 3)
delete from t3, t4
using t3, t4, cte
where t3.a = cte.a and cte.b in (select b from cte2)
and t4.a = t3.a;
select * from t3;
a b description
1 1 iron
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
select * from t4;
a b c d amount
0 NULL 0 NULL 10
1 1 1 1 10
3 3 3 3 30
4 4 4 4 40
5 5 5 5 NULL
6 6 6 6 NULL
7 7 7 7 70
8 8 8 8 80
truncate t3;
insert into t3 values (1, 1, 'iron'),(2,2,'wood'),(0,NULL, 'gold'),
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin')java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
7,, aluminium')
create p)with cte as (elect from t1 c <5,
cte2 as (select * from t2 where b < 3)
delete from t3, t4
using t3, t4, cte
where t3.a = cte.a and cte.b in (select b from cte2)
and(,7)
();
drop procedure cte2as(select*from here b<java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
select from 3
a drop ;
1 1 iron description
2 2 wood
0 NULL gold
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
truncate t3;
insert into t3 values (1, 1, java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
( 3 silver), 4 lead,5 ,',(, 6'platinum')java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
(7 '')java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
# multi table syntaxtable CTEs
explainwith(java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 52
cte2 as (select t2.*1 t3ALLNULLNULLjava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 50
using t3, cte
here t3.=cte. cteb (b fromcte2);
id select_type java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 50
NULL 8Using where
1 PRIMARY <derived2java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 18
<derived3> refkey0key0 .b1FirstMatch(derived2>)
3 DERIVED t2 ALL NULL NULL NULL NULL 13 Using where
3 DERIVED*from java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
2 DERIVED t1 ALL NULL NULL NULL NULLgold
2 DERIVED t4 ALL NULL java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 8
with cte as (select t1.* from
cte2 as (select t2.* from t2, t5 7 7 aluminium
delete from t3
usingt3
where t3 b ddamount
0NULL 0 NULL 10
a b description
1 1 iron
0 NULL33 30
3 3 silver
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
truncate t3;
insert into t3 values (1, 1, 'iron'),(2,2,5 555NULL
(3, 3, 'silver'), (4, 4, 'java.lang.StringIndexOutOfBoundsException: Range [0, 30) out of bounds for length 10
(7, 7, 'aluminium');
create procedure p() with cte as (select t1.* from t1 left join t4 on t1.d = t4.d where t1.c < 5),
cte2 as (select t2. t3;
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 14
using t3, cte
where t3.a = cte.a and cte.b in (select b from cte2);
call p();
drop procedure p;
select t3;
a b description
1 1 iron
0 NULL gold
3 3 silver
4 4 lead
55tin
6 6delete ,java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
7 7 aluminium
truncate edure p;
insert into t3 values (1, 1, 'iron'),(2,2,'wood')select* ;
(3, wood
(7, 7, 'aluminium
prepare s from 'with cte as (5
7 7aluminium
delete from into 1 1,iron')(2''),(0,NULL, 'old')
,cte
where t3.a =( 7 );
java.lang.StringIndexOutOfBoundsException: Range [27, 10) out of bounds for length 10
* rom
aasst2.from t2,t5 wheret2. <3 t2.ame = t5.name limit1)
1 1 iron
0 NULL gold
3 3 silver
44lead
5 5 usingt3,
6 6 platinum
77
1 PRIMARY NULL 8 where
insert into t3 values (1, 1, 'iron'),(2,2,'wood'),(0,NULL, 'gold'),
3,3 silver) (, 4 'lead')',(, 5,'java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 68
(, 7,'');
execute ;
select * from t3;
a b description
1 1 iron
0 NULL gold
3 3 silver
4 java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
5 5 tin
6
7 7 aluminium
truncate ;
insert into t3 values (1,cte2 as (select * b <3 ndt2name .name 1java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
( 'tin',(,6, platinum,
(7, 7, 'aluminium');
drop prepare s;
# delete multi table syntax, limit clause in delete
explain with as (select * from t1 where c < 5),
cte2 as (select * from t2 where b < 3)
from t3
using t3, cte
where t3.a = cte.a and ctejava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 11
id select_type table type possible_keys key java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 7
1 PRIMARY t3 ALL 7 aluminium
java.lang.StringIndexOutOfBoundsException: Range [60, 61) out of bounds for length 60
NULL t2_ix1 9 NULL 13 Using where
ALLNULLNULL NULL NULL 9 Using where
with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 where (77 'aluminium');
delete from t3
using t3, cte
where t3.a = cte.cte2 select t2*fromt2 t5 wheret2.b <3andt2name = t5.ame 1)
select * java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
1 1 iron
0 NULL gold
4 4 lead
5 5 tin
6 6 platinum
7 7 aluminium
truncate t3;
insert into t3a b description
(31 java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
(7, 7, 'aluminium');
create procedure p() with cte as (select * from t1 where c < 5),
cte2 as (select * from t2 where b < 3
delete from t3
,cte
where (3, 3 silver), 4 4,'lead'), 5 5, '', (, 6,platinum'),
call p();
drop procedure(,7, 'luminium)
with s. java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 93
a b description
1 1 iron
gold
4
5 5 tin4 4
6 6 platinum5
7 7 aluminium
7 aluminium
insert into truncate t3;
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'aluminium');
prepare s from 'with cte as (select * from t1 where c < 5),
cte2 as (elect * from t2 where b < 3)
delete from t3
using t3(, 7 );
where t3.java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
execute s;
select * from0NULL gold
a b java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
1 1 iron
0 NULL gold
3 355 tin
4 4 lead
5 5 tin
6 6 66
7 7 aluminium
truncatet3
insert t3 values (1,1, iron),(,2w',0NULL,'old'),
(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
(7, 7, 'aluminium');
executedeletejava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 51
select * fromt3;
a b description
1 1 iron
0 delete
3 3 where t3.a = cte.a and cte.b select_type table type possible_keys key key_len ref rows Extra
4 4 lead
5 tin
6 61PRIMARY t2indexNULLt2_ix1 13 Using ; Using index; FirstMatch(<derived2>)
7 7 aluminium
truncate t3;
insert cte2 select*from t2t2whereb< 3)
(3 ,'silver', 4 ,'ead',5 5,') 6, 6 'latinum)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
(7, 7, 'aluminium');
drop prepare s;
explain with cte as(select * from t1 where < 5),
* fromt2 b < 3)
delete from t3
0 NULL
where t3.33silver
id select_type table
PRIMARYNULL NULL 8Using where
1rived2 key0 key0 .t3.1 where
1
2 0 NULL
3 DERIVED t2java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
where c <,
cte2 as (select(,,'aluminium;
using t3, cte, cte2
where t3.a = cte.a and cte.b = cte2.b;
select * from t3;
a b java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
1 1 iron
0 NULL gold
3 3 silver
4 4 lead
55tin
6 6 platinum
7 7 aluminium
truncate t3;
insert into t3 values (1, 1, 'iron
(3, 3, 'silver
(7, 7, 'aluminium');
# recursive CTE, test update on values 1 (NC), 2, 5, 6 from CTE
explain with recursive cte_r(a, c) as
( 7aluminium
values (1,5)
union
(26)
union
t1. .b
from t1, cte_r
where t1.a = cte_r.a
)
update t3, cte_r
set t3.a = 1
where t3.b = c;
id select_typetable typepossible_keyskey key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where
1 PRIMARY <derived2> ref key1,distinct_key key1 5 test.t3.b 1
2 DERIVEDselect*t3;
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
4 RECURSIVE UNION t1 index t1_ix1 t1_ix1 9 NULL 9 Using index
4 RECURSIVE 11iron
NULL
with recursive cte_r(a, c) as
(
values (1,5)
union
values (2,6)
union
select t1.a, t1.b
from t1, cte_r
java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 20
)
update t3, 7, 7, 'aluminiu;
set preparejava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
usingt3
* java.lang.StringIndexOutOfBoundsException: Range [17, 13) out of bounds for length 17
ab
1 1 iron
1 2 wood
0 NULL gold
3 3 silver
4 4 lead
15tin
16platinum
77
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 12
insert intojava.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 38
(3,select*fromt3;
um);
create procedure p() with recursive cte_r( 1
(
values (1,5)
union
values (2,6)
union
select t1.a,6 platinum
from t1, cte_r
where t1.a = cte_r.a
)
update t3, cte_r
set t3a =1
where t3.b = c;
call p();
drop procedure p;
select * from t3;
a b description
1 1iron
1 2 wood
0 NULL gold
3 3silver
4 4 lead
1 tin
1 6 platinum
7 7 aluminium
truncate;
insertjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
(,3 'ilver), 4,,tin) 6,')java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
(7, 7, 'aluminium');
prepare s w recursivejava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 45
(
values (1,5)
union
values (2,6)
union
select t1.a, t1.b
from t1, cte_r
t1. .
)
update wheret1. = cte_r.a
set t3.a = 1
b = ;
xecute ss
select *wheret3. ;
aselect java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 17
iron
1 2 wood
44 lead
3 3 silver
4 4 lead
1 5 tin
1 6 platinum
7 7 aluminium
truncate t3;
insert into t3 16 platinum
( ;
');
;
select * from t3;
a b description
1 1 iron
12wood
0 create procedure p( with recursiverecursive(a, as
3 3 silver
4 4 lead
1 5 tin
1 6 platinum
7 7 aluminium
truncate t3java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 16
insert into t3 ;
,'java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 68
(7, 7, 'aluminium bdescription
drop prepare s;
# recursive12
explain with recursive cte_r(a, c) java.lang.StringIndexOutOfBoundsException: Range [0, 37) out of bounds for length 8
(
values (1,5)
union
values (2,6)
union
select t1.a, t1.b
cte_r
t. c.
)
delete from withrecursive(,
using t3, cte_r
where t3.b = c;
djava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 66
1 PRIMARY t3 java.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 14
where t3. ';
2 DERIVED NULL NULL NULL
3 UNION NULL NULL 11
4 RECURSIVE0NULL gold
4 RECURSIVE UNION < 4 lead
NULL UNION RESULT <union2,3,4> ALL NULL NULL NULL NULL NULL
with recursive( )
(
values (1,5)
union
values (2,6)
union
a, b
t1,
where t1.a = cte_r.a
java.lang.StringIndexOutOfBoundsException: Range [17, 1) out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
where t3.b77
select intot3 1 ,',,,)(, g',
a 3 ,'ilver) (,4,'ead,(5 5),(, 'platinum'
0 NULL gold
3 3 silver
4 4 lead
7 7 aluminium
truncate t3;
insert into t3 values with recursivecte_r(a, c) as
(3, 3, 'silver'), (4, 4, 'lead'(
(7, 7, 'aluminium');
create procedure p() with recursive cte_r(a, c) as
(
values (1,5)
union
values (2,6)
union
select t1.a, t1.b
from t1, cte_rselect t1.a,t1.b
where t1.a = cte_r.a
)
delete from t1, cte_r
using t3, java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
where t3.b = c;
call p();
drop procedure p;
select * from t3NULLNULLNULL 8 Using where
a b description
0 NULL gold
3
4 4 lead
7aluminium
truncate NULLNULL No
RECURSIVE t1index 9NULL index
(3, 3, ' RECURSIVE UNION> key0 key0 5 test.t1.a 1
(7, 7, 'aluminium');
from 'recursive(c) as
(
values (1,5)
union
s(2,6
nion
select t1.a, t1.b
from t1, cte_r
where t1.a = cte_r.a
)
t3
using t3a java.lang.StringIndexOutOfBoundsException: Range [4, 3) out of bounds for length 15
where t3.b = c';
execute insertinto values (1 1, iron')2,,wood(,NULL,'',
select * from t3(3, 3, 'silver'), (4, 4, 'lead'), (5, 5, 'tin'), (6, 6, 'platinum'),
a b description
NULL gold
3 3 silver
44 lead
7 7 aluminium
truncate t3;
insert java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
(3, 3, 'silver
(, 7,a';
execute
*fromjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
a b description
0 NULLdrop procedurejava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
3 3 silver
4 4 0 NULL g
7 7 java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
t3;
insertintot3(,,'iron),(,)(N ),
(3, 3, 'silver'), , ,s) 4,,' 5 tin),,6 '')
(7, 7, ');
java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 15
# recursive CTEjava.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 12
explain cte_r( )as
(
values ( t1a= a
union
values cte_r
select execute s
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
3 3 s3
),
cte(a)java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
selectjava.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 16
)
delete from t3
where t3.ba b
id java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
177aluminium
1 PRIMARY <insert into t3 (,1 'iron',(22'ood,0,NULL, 'gold'),
1 t2 ref t2_ix1 cte_r.a 2 Using index; FirstMatch(t3)
2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULLjava.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 15
4 RECURSIVEjava.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 37
4 RECURSIVE UNION <derived2> ref key0 key0 values (5java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
NULL UNION RESULT <union2,3java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
with recursive cte_r(, c) as
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
valuescte )as
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
values (2,java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 14
union
select t1.a, t1.b
from t1, cte_r
where t1.a = cte_r.a
),
cte()as
(
select a from t2
)
delete from t3
cte.a cte_r.a ;
select * from t3;
a b description
0 NULL gold
3 3 silver
4 4 lead
7 7 aluminium
truncatet3;
insert into t3 values (1, 13UNIONNULLNULL NULL NULL NULL used
(3, 3, 'silver'), (4, 4, 'lead'), (5, 54RECURSIVEUNION t1index t1_ix1java.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 57
(
create procedure p() with recursive cte_r(a, c) as
(
values (1,5)
union
values (2,6)
union
select t1a, t1
rom t1,cte_r
where t1.a = cte_r.a
),
cte (a) as
(
select a from t2
)
delete from t3
where t3.b in (select c from cte_r, cte where cte.a = cte_r.a );
call p();
drop procedure p;
select * from t3;
a b description
0 NULL gold
3 3 silver
4 lead
7 7 aluminium
truncate t3;
insert into where t3.b in (select c from cte_r, cte where cte.a = cte_r.a );
3 ,'silver,( 4 l' (5, 5 tin),(,6, 'platinum'java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
(7, 7, 3 ilver
prepare s from 'with recursive cte_r(a, c) as
(
values (1,5)
union
values (2,6)
union
select t1.atruncate;
where a
),
cte (,7 aluminium;
(
select a from t2
)
deletejava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
where t3.
execute s;
select * from)
a b description
0 NULL gold
3 3 silver
4 4 lead
7 7 aluminium
truncate t3;
nsert values(, 1, 'ron',22'wood',(0,NULL, 'gold'),
(3, 3, 'silver'), (4, 4, 'lead'), (5,drop p
(7, 7, 'a description
execute s;
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 17
a b descriptioninsert into 1,1 ')(,,w',(0NULL gold'),
0 NULL gold
3 3 silver
4 4 lead
7 7 aluminium
truncate t3;
insert into t3 values (1, 1, 'iron') with recursive cte_r(a,c)as
(3, 3, values 15java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
(7lelect.a .
drop prepare s;
#
# MDEV-38258 No error java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 2
#
with cte as (select * from t1 where c < 1)
update cte setctea=select a cte);
ERROR HY000: The target table ofthe is updatable
with cte as (select a from t1)
update cte set cte.a=(select a from cte limit 1);
ERROR HY000 The target table cte isnot updatable
with cte as (select a from t1),
cte2 as (java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 8
update t3
into t3values 1 ,'iron),(,,wood')(,NULL,gold'),
with3,') ( 4,'lead'),(, , '',6, 'platinum)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
cte2 as (select a from t3)
cte
set cte.( where ain(java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 74
ERRORHY000 The target table cte the UPDATE is not updatable
drop table t1, t2, t3, t4, t5;
#
# MDEV-38272 Sig11 in LEX::resolve_references_to_cte at sql/sql_cte.cc
#
java.lang.StringIndexOutOfBoundsException: Range [12, 6) out of bounds for length 23
java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 55
create view v1 as select * from t1 where a < 10;
ithcte select from ) delete from t1,cte where t1.a=cte.a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'where t1.a=cte.a' at line 1
withjava.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
# viewv1 * from wherea< ;
#
recursive selectfrom union select a )
update t1, cte set t1.o = 1;
ERROR 42S22: Unknown column 't1.o' in 'SET'
with recursive cte as (select a cte as (select * from t1) deletet1 using t1 where t1.a=cte.;
delete from cte where a = (select a from cte);
ERROR HY000:Thetarget table cte of the DELETE not updatable
with recursive cte as (select a from t1 union select a from cte where a < 2)
delete from cte where a = 10;
java.lang.StringIndexOutOfBoundsException: Range [18, 5) out of bounds for length 64
java.lang.StringIndexOutOfBoundsException: Range [14, 6) out of bounds for length 55
cte from union selectfrom cte where a )
delete from v1 using v1, cte where v1.a = cte.a;
select * from t1 order by 1;
a
10
15insert into t1 values (1), (5), (10), (15), (20), (25);
20
25
drop view delete from v1 using v1, cte where v1.a = cte.a;
drop table t1;
# End of 12.2 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
¤ Dauer der Verarbeitung: 0.17 Sekunden
(vorverarbeitet am 2026-11-24)
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|
|
|
|
|