Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions mysql-test/main/intersect_all.result
Original file line number Diff line number Diff line change
Expand Up @@ -1023,13 +1023,12 @@ NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL
set sql_mode= 'oracle';
explain SELECT * from t3 union select * from u3 intersect all select * from i3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 2
4 DERIVED <derived2> ALL NULL NULL NULL NULL 2
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
5 INTERSECT NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL INTERSECT RESULT <intersect4,5> ALL NULL NULL NULL NULL NULL
4 INTERSECT i3 system NULL NULL NULL NULL 0 Const row not found
NULL INTERSECT RESULT <intersect1,4> ALL NULL NULL NULL NULL NULL
select x from t3 union select x from u3 intersect select x from i3;
x
SELECT x from t3 union select x from u3 intersect all select x from i3;
Expand Down Expand Up @@ -1153,23 +1152,22 @@ a b
2 3
explain select * from t1 intersect all select * from t2 union values (1, 2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 8
4 DERIVED <derived2> ALL NULL NULL NULL NULL 7
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7
2 DERIVED t1 ALL NULL NULL NULL NULL 7
3 INTERSECT t2 ALL NULL NULL NULL NULL 7
NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL
5 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL
4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE VIEW "v1" AS select "__6"."a" AS "a","__6"."b" AS "b" from (select "__4"."a" AS "a","__4"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" intersect all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__4" union values (1,2)) "__6" latin1 latin1_swedish_ci
v1 CREATE VIEW "v1" AS select "__5"."a" AS "a","__5"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" intersect all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__5" union values (1,2) latin1 latin1_swedish_ci
select * from v1;
a b
1 2
2 3
show create view v2;
View Create View character_set_client collation_connection
v2 CREATE VIEW "v2" AS select "__7"."a" AS "a","__7"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" union select "__5"."1" AS "1","__5"."2" AS "2" from (select "__6"."1" AS "1","__6"."2" AS "2" from (values (1,2) intersect all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__6") "__5") "__7" latin1 latin1_swedish_ci
v2 CREATE VIEW "v2" AS select "t1"."a" AS "a","t1"."b" AS "b" from "t1" union select "__5"."1" AS "1","__5"."2" AS "2" from (values (1,2) intersect all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__5" latin1 latin1_swedish_ci
select * from v2;
a b
1 2
Expand All @@ -1178,7 +1176,7 @@ a b
create view v3 as select * from t1 union values (1, 2) intersect all select * from t2;
show create view v3;
View Create View character_set_client collation_connection
v3 CREATE VIEW "v3" AS select "__6"."a" AS "a","__6"."b" AS "b" from (select "__8"."a" AS "a","__8"."b" AS "b" from (select "__4"."a" AS "a","__4"."b" AS "b" from (select "__6"."a" AS "a","__6"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" union values (1,2)) "__6") "__4" intersect all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__8") "__6" latin1 latin1_swedish_ci
v3 CREATE VIEW "v3" AS select "__5"."a" AS "a","__5"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" union values (1,2)) "__5" intersect all select "t2"."a" AS "a","t2"."b" AS "b" from "t2" latin1 latin1_swedish_ci
select * from v3;
a b
1 2
Expand Down Expand Up @@ -1255,20 +1253,19 @@ set sql_mode= 'oracle';
create view v2 as select * from t1 except all select * from t2 intersect all values (1, 2);
show create view v2;
View Create View character_set_client collation_connection
v2 CREATE VIEW "v2" AS select "__6"."a" AS "a","__6"."b" AS "b" from (select "__8"."a" AS "a","__8"."b" AS "b" from (select "__4"."a" AS "a","__4"."b" AS "b" from (select "__6"."a" AS "a","__6"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" except all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__6") "__4" intersect all values (1,2)) "__8") "__6" latin1 latin1_swedish_ci
v2 CREATE VIEW "v2" AS select "__5"."a" AS "a","__5"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" except all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__5" intersect all values (1,2) latin1 latin1_swedish_ci
select * from v2;
a b
1 2
drop view v2;
EXPLAIN select * from t1 except all select * from t2 intersect all values (1, 2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 2
4 DERIVED <derived2> ALL NULL NULL NULL NULL 4
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
2 DERIVED t1 ALL NULL NULL NULL NULL 4
3 EXCEPT t2 ALL NULL NULL NULL NULL 2
NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL
5 INTERSECT NULL NULL NULL NULL NULL NULL NULL No tables used
NULL INTERSECT RESULT <intersect4,5> ALL NULL NULL NULL NULL NULL
4 INTERSECT NULL NULL NULL NULL NULL NULL NULL No tables used
NULL INTERSECT RESULT <intersect1,4> ALL NULL NULL NULL NULL NULL
select * from t2 union all select * from t2;
a b
1 2
Expand Down
110 changes: 66 additions & 44 deletions mysql-test/main/set_operation_oracle.result
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ a b
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 <derived6> ALL NULL NULL NULL NULL 2 100.00
6 DERIVED <derived4> ALL NULL NULL NULL NULL 2 100.00
4 DERIVED <derived2> ALL NULL NULL NULL NULL 4 100.00
1 PRIMARY <derived5> ALL NULL NULL NULL NULL 2 100.00
5 DERIVED <derived2> ALL NULL NULL NULL NULL 4 100.00
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00
3 UNION t2 ALL NULL NULL NULL NULL 2 100.00
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
5 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00
NULL INTERSECT RESULT <intersect4,5> ALL NULL NULL NULL NULL NULL NULL
7 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union6,7> ALL NULL NULL NULL NULL NULL NULL
4 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.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 "__7"."a" AS "a","__7"."b" AS "b" from (/* select#6 */ select "__5"."a" AS "a","__5"."b" AS "b" from (/* select#4 */ select "__3"."a" AS "a","__3"."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")) "__3" intersect (/* select#5 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3")) "__5" union (/* select#7 */ select 4 AS "4",4 AS "4")) "__7"
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
3 3
Expand All @@ -33,18 +32,15 @@ e f
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 <derived6> ALL NULL NULL NULL NULL 4 100.00
6 DERIVED <derived4> ALL NULL NULL NULL NULL 4 100.00
4 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED t3 ALL NULL NULL NULL NULL 2 100.00
3 INTERSECT t2 ALL NULL NULL NULL NULL 2 100.00
NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL
5 UNION t1 ALL NULL NULL NULL NULL 2 100.00
NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL
7 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union6,7> ALL NULL NULL NULL NULL NULL NULL
4 UNION t1 ALL NULL NULL NULL NULL 2 100.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 "__7"."e" AS "e","__7"."f" AS "f" from (/* select#6 */ select "__5"."e" AS "e","__5"."f" AS "f" from (/* select#4 */ select "__3"."e" AS "e","__3"."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")) "__3" union (/* select#5 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1")) "__5" union (/* select#7 */ select 4 AS "4",4 AS "4")) "__7"
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);
Expand Down Expand Up @@ -76,33 +72,31 @@ a b
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 <derived6> ALL NULL NULL NULL NULL 2 100.00
6 DERIVED <derived4> ALL NULL NULL NULL NULL 2 100.00
4 DERIVED <derived2> ALL NULL NULL NULL NULL 4 100.00
1 PRIMARY <derived5> ALL NULL NULL NULL NULL 2 100.00
5 DERIVED <derived2> ALL NULL NULL NULL NULL 4 100.00
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00
3 UNION t2 ALL NULL NULL NULL NULL 2 100.00
5 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00
NULL INTERSECT RESULT <intersect4,5> ALL NULL NULL NULL NULL NULL NULL
7 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
4 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.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 "__7"."a" AS "a","__7"."b" AS "b" from (/* select#6 */ select "__5"."a" AS "a","__5"."b" AS "b" from (/* select#4 */ select "__3"."a" AS "a","__3"."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") "__3" intersect /* select#5 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3") "__5" union all /* select#7 */ select 4 AS "4",'4' AS "4") "__7"
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
3 3
4 4
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 <derived6> ALL NULL NULL NULL NULL 2 100.00
6 DERIVED <derived4> ALL NULL NULL NULL NULL 2 100.00
4 DERIVED <derived2> ALL NULL NULL NULL NULL 4 100.00
1 PRIMARY <derived5> ALL NULL NULL NULL NULL 2 100.00
5 DERIVED <derived2> ALL NULL NULL NULL NULL 4 100.00
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00
3 UNION t2 ALL NULL NULL NULL NULL 2 100.00
5 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00
NULL INTERSECT RESULT <intersect4,5> ALL NULL NULL NULL NULL NULL NULL
7 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
4 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.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 "__7"."a" AS "a","__7"."b" AS "b" from (/* select#6 */ select "__5"."a" AS "a","__5"."b" AS "b" from (/* select#4 */ select "__3"."a" AS "a","__3"."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") "__3" intersect all /* select#5 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3") "__5" union all /* select#7 */ select 4 AS "4",'4' AS "4") "__7"
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
3 3
Expand All @@ -112,16 +106,14 @@ e f
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 <derived6> ALL NULL NULL NULL NULL 4 100.00
6 DERIVED <derived4> ALL NULL NULL NULL NULL 4 100.00
4 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED t3 ALL NULL NULL NULL NULL 2 100.00
3 INTERSECT t2 ALL NULL NULL NULL NULL 2 100.00
NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL
5 UNION t1 ALL NULL NULL NULL NULL 2 100.00
7 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
4 UNION t1 ALL NULL NULL NULL NULL 2 100.00
5 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 /* select#1 */ select "__7"."e" AS "e","__7"."f" AS "f" from (/* select#6 */ select "__5"."e" AS "e","__5"."f" AS "f" from (/* select#4 */ select "__3"."e" AS "e","__3"."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") "__3" union all /* select#5 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1") "__5" union all /* select#7 */ select 4 AS "4",'4' AS "4") "__7"
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
3 3
Expand All @@ -131,16 +123,14 @@ e f
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 <derived6> ALL NULL NULL NULL NULL 4 100.00
6 DERIVED <derived4> ALL NULL NULL NULL NULL 4 100.00
4 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED t3 ALL NULL NULL NULL NULL 2 100.00
3 INTERSECT t2 ALL NULL NULL NULL NULL 2 100.00
NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL
5 UNION t1 ALL NULL NULL NULL NULL 2 100.00
7 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
4 UNION t1 ALL NULL NULL NULL NULL 2 100.00
5 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 /* select#1 */ select "__7"."e" AS "e","__7"."f" AS "f" from (/* select#6 */ select "__5"."e" AS "e","__5"."f" AS "f" from (/* select#4 */ select "__3"."e" AS "e","__3"."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") "__3" union all /* select#5 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1") "__5" union all /* select#7 */ select 4 AS "4",'4' AS "4") "__7"
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;
Expand Down Expand Up @@ -174,10 +164,10 @@ bar
set sql_mode=oracle;
show create view v;
View Create View character_set_client collation_connection
v CREATE VIEW "v" AS select "__4"."a" AS "a" from (select 'foo' AS "a" union select 'bar' AS "a") "__4" latin1 latin1_swedish_ci
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 "__4"."a" AS "a","__4"."b" AS "b" from (select 'foo' AS "a",'baz' AS "b" union select 'bar' AS "a",'qux' AS "b") "__4" latin1 latin1_swedish_ci
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
Expand All @@ -199,4 +189,36 @@ 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
Loading