create table t1 (a int, b blob) engine=MyISAM;
create table t2 (c int, d blob) engine=MyISAM;
create table t3 (e int, f blob) engine=MyISAM;
insert into t1 values (5,5),(6,6);
insert into t2 values (2,2),(3,3);
insert into t3 values (1,1),(3,3); set SQL_MODE=ORACLE;
(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
a b 33 44
explain extended
(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <derived5> ALL NULL NULL NULL NULL 2100.00 5 DERIVED <derived2> ALL NULL NULL NULL NULL 4100.00 2 DERIVED t1 ALL NULL NULL NULL NULL 2100.00 3 UNION t2 ALL NULL NULL NULL NULL 2100.00
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL 4 INTERSECT t3 ALL NULL NULL NULL NULL 2100.00
NULL INTERSECT RESULT <intersect5,4> ALL NULL NULL NULL NULL NULL NULL 6 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003/* select#1 */ select "__6"."a" AS "a","__6"."b" AS "b" from (/* select#5 */ select "__4"."a" AS "a","__4"."b" AS "b" from ((/* select#2 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1") union (/* select#3 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2")) "__4" intersect (/* select#4 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3")) "__6" union (/* select#6 */ select 4 AS "4",4 AS "4")
(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
e f 33 55 66 44
explain extended
(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2100.00 2 DERIVED t3 ALL NULL NULL NULL NULL 2100.00 3 INTERSECT t2 ALL NULL NULL NULL NULL 2100.00
NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL 4 UNION t1 ALL NULL NULL NULL NULL 2100.00 5 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union1,4,5> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003/* select#1 */ select "__4"."e" AS "e","__4"."f" AS "f" from ((/* select#2 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3") intersect (/* select#3 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2")) "__4" union (/* select#4 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1") union (/* select#5 */ select 4 AS "4",4 AS "4")
create table t12(c1 int);
insert into t12 values(1);
insert into t12 values(2);
create table t13(c1 int);
insert into t13 values(1);
insert into t13 values(3);
create table t234(c1 int);
insert into t234 values(2);
insert into t234 values(3);
insert into t234 values(4);
select * from t13 union select * from t234 intersect select * from t12;
c1 1 2 set SQL_MODE=default;
drop table t1,t2,t3;
drop table t12,t13, t234;
create table t1 (a int, b blob) engine=MyISAM;
create table t2 (c int, d blob) engine=MyISAM;
create table t3 (e int, f blob) engine=MyISAM;
insert into t1 values (5,5),(6,6);
insert into t2 values (2,2),(3,3);
insert into t3 values (1,1),(3,3); set SQL_MODE=ORACLE;
select a,b from t1 union all select c,d from t2 intersect select e,f from t3 union all select 4,'4' from dual;
a b 33 44
explain extended
select a,b from t1 union all select c,d from t2 intersect select e,f from t3 union all select 4,'4' from dual;
id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <derived5> ALL NULL NULL NULL NULL 2100.00 5 DERIVED <derived2> ALL NULL NULL NULL NULL 4100.00 2 DERIVED t1 ALL NULL NULL NULL NULL 2100.00 3 UNION t2 ALL NULL NULL NULL NULL 2100.00 4 INTERSECT t3 ALL NULL NULL NULL NULL 2100.00
NULL INTERSECT RESULT <intersect5,4> ALL NULL NULL NULL NULL NULL NULL 6 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003/* select#1 */ select "__6"."a" AS "a","__6"."b" AS "b" from (/* select#5 */ select "__4"."a" AS "a","__4"."b" AS "b" from (/* select#2 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1" union all /* select#3 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2") "__4" intersect /* select#4 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3") "__6" union all /* select#6 */ select 4 AS "4",'4' AS "4"
select a,b from t1 union all select c,d from t2 intersect all select e,f from t3 union all select 4,'4' from dual;
a b 33 44
explain extended
select a,b from t1 union all select c,d from t2 intersect all select e,f from t3 union all select 4,'4' from dual;
id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <derived5> ALL NULL NULL NULL NULL 2100.00 5 DERIVED <derived2> ALL NULL NULL NULL NULL 4100.00 2 DERIVED t1 ALL NULL NULL NULL NULL 2100.00 3 UNION t2 ALL NULL NULL NULL NULL 2100.00 4 INTERSECT t3 ALL NULL NULL NULL NULL 2100.00
NULL INTERSECT RESULT <intersect5,4> ALL NULL NULL NULL NULL NULL NULL 6 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003/* select#1 */ select "__6"."a" AS "a","__6"."b" AS "b" from (/* select#5 */ select "__4"."a" AS "a","__4"."b" AS "b" from (/* select#2 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1" union all /* select#3 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2") "__4" intersect all /* select#4 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3") "__6" union all /* select#6 */ select 4 AS "4",'4' AS "4"
select e,f from t3 intersect select c,d from t2 union all select a,b from t1 union all select 4,'4' from dual;
e f 33 55 66 44
explain extended
select e,f from t3 intersect select c,d from t2 union all select a,b from t1 union all select 4,'4' from dual;
id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2100.00 2 DERIVED t3 ALL NULL NULL NULL NULL 2100.00 3 INTERSECT t2 ALL NULL NULL NULL NULL 2100.00
NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL 4 UNION t1 ALL NULL NULL NULL NULL 2100.00 5 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003/* select#1 */ select "__4"."e" AS "e","__4"."f" AS "f" from (/* select#2 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3" intersect /* select#3 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2") "__4" union all /* select#4 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1" union all /* select#5 */ select 4 AS "4",'4' AS "4"
select e,f from t3 intersect all select c,d from t2 union all select a,b from t1 union all select 4,'4' from dual;
e f 33 55 66 44
explain extended
select e,f from t3 intersect all select c,d from t2 union all select a,b from t1 union all select 4,'4' from dual;
id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2100.00 2 DERIVED t3 ALL NULL NULL NULL NULL 2100.00 3 INTERSECT t2 ALL NULL NULL NULL NULL 2100.00
NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL 4 UNION t1 ALL NULL NULL NULL NULL 2100.00 5 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003/* select#1 */ select "__4"."e" AS "e","__4"."f" AS "f" from (/* select#2 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3" intersect all /* select#3 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2") "__4" union all /* select#4 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1" union all /* select#5 */ select 4 AS "4",'4' AS "4" set SQL_MODE=default;
drop table t1,t2,t3; set SQL_MODE=oracle;
select * from t13 union select * from t234 intersect all select * from t12; ERROR42S02: Table 'test.t13' doesn't exist set SQL_MODE=default;
#
# MDEV-38799 Some views are broken in Oracle mode after upgrade to Q1 2026
# set sql_mode='';
create view v as select 'foo' as a union select 'bar' as a;
create view v2 as select 'foo' as a, 'baz' as b union select 'bar' as a, 'qux' as b;
create view v3 as select * from (select 'foo' as a, 'baz' as b) s union select * from (select 'bar' as a, 'qux' as b) s2;
create view v4 as select * from (select 'foo' as a) s union select * from (select 'bar' as a) s2;
select a from v;
a
foo
bar
select a, b from v2;
a b
foo baz
bar qux
select a, b from v3;
a b
foo baz
bar qux
select a from v4;
a
foo
bar set sql_mode=oracle;
show create view v;
View Create View character_set_client collation_connection
v CREATE VIEW "v" AS select 'foo' AS "a" union select 'bar' AS "a" latin1 latin1_swedish_ci
show create view v2;
View Create View character_set_client collation_connection
v2 CREATE VIEW "v2" AS select 'foo' AS "a",'baz' AS "b" union select 'bar' AS "a",'qux' AS "b" latin1 latin1_swedish_ci
select a from v;
a
foo
bar
select a, b from v2;
a b
foo baz
bar qux
select a, b from v3;
a b
foo baz
bar qux
select a from v4;
a
foo
bar
drop view v;
drop view v2;
drop view v3;
drop view v4; set sql_mode=default;
#
# MDEV-39522 Query with UNION fails in Oracle sql_mode with ER_BAD_FIELD_ERROR/ER_UNKNOWN_TABLE
# set sql_mode='oracle';
create table t1 (id varchar(10));
select 1 from t1 where exists (select 1 from dual union select 1 from dual where t1.id=1); 1
drop table t1; set sql_mode=default;
# ansi: 1 union (2 intersect 2) = {1,2}
select 1 a union select 2 intersect select 2;
a 1 2 set sql_mode='oracle';
# oracle: (1 union 2) intersect 2 = {2}
select 1 a union select 2 intersect select 2;
a 2
# recursive CTE with set operator wraps nothing (anchor preserved)
with recursive c(n) as
(
select 1 from dual
union all
select n+1 from c where n < 3
)
select * from c;
n 1 2 3 set sql_mode=default;
# End of 10.11 tests
#
# MDEV-38987 ASAN heap-use-after-free upon using a view through a trigger in ORACLE mode
# set sql_mode = oracle;
create table t1 (f int);
create table t2 (a int);
create view v as select 'x' union select 'x' union select 'x';
create trigger tr before insert on t1 for each row delete from v;
insert into t1 values (1); ERROR HY000: The target table v of the DELETE is not updatable
drop view v;
create view v as select * from t2;
INSERT into t1 values (2);
drop view v;
drop table t1, t2;
# End of 11.4 tests
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.