1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-17 12:02:09 +03:00

MDEV-11953: support of brackets in UNION/EXCEPT/INTERSECT operations

This commit is contained in:
Oleksandr Byelkin
2018-05-22 19:08:39 +02:00
parent 1b981b9edb
commit de745ecf29
298 changed files with 36118 additions and 3473 deletions

View File

@ -94,7 +94,7 @@ insert into t2 values(0, 0), (1, 20), (2, 30);
commit; commit;
connection con1; connection con1;
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE; select a,b from t2 UNION (SELECT id, x from t1 FOR UPDATE);
select * from t2; select * from t2;
select * from t1; select * from t1;

View File

@ -250,6 +250,8 @@ insert into t1 values (1);
analyze select * from t1 into @var; analyze select * from t1 into @var;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 NULL 100.00 NULL 1 SIMPLE t1 system NULL NULL NULL NULL 1 NULL 100.00 NULL
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
drop table t1; drop table t1;
# #
# MDEV-6394: ANALYZE DELETE .. RETURNING fails with ERROR 2027 Malformed packet # MDEV-6394: ANALYZE DELETE .. RETURNING fails with ERROR 2027 Malformed packet
@ -284,6 +286,8 @@ insert into t1 values (1),(2);
analyze select a from t1 where a <2 into @var; analyze select a from t1 where a <2 into @var;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 100.00 50.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 100.00 50.00 Using where
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
analyze select a from t1 into @var; analyze select a from t1 into @var;
ERROR 42000: Result consisted of more than one row ERROR 42000: Result consisted of more than one row
analyze insert into t1 select * from t1; analyze insert into t1 select * from t1;

View File

@ -0,0 +1,210 @@
select 1 union ( select 2 union select 3);
1
1
2
3
explain extended
select 1 union ( select 2 union select 3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
4 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 /* select#1 */ select 1 AS `1` union /* select#4 */ select `__4`.`2` AS `2` from (/* select#2 */ select 2 AS `2` union /* select#3 */ select 3 AS `3`) `__4`
select 1 union ( select 1 union select 1);
1
1
explain extended
select 1 union ( select 1 union select 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
4 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 /* select#1 */ select 1 AS `1` union /* select#4 */ select `__4`.`1` AS `1` from (/* select#2 */ select 1 AS `1` union /* select#3 */ select 1 AS `1`) `__4`
select 1 union all ( select 1 union select 1);
1
1
1
explain extended
select 1 union all ( select 1 union select 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
4 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 /* select#1 */ select 1 AS `1` union all /* select#4 */ select `__4`.`1` AS `1` from (/* select#2 */ select 1 AS `1` union /* select#3 */ select 1 AS `1`) `__4`
select 1 union ( select 1 union all select 1);
1
1
explain extended
select 1 union ( select 1 union all select 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
4 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 /* select#1 */ select 1 AS `1` union /* select#4 */ select `__4`.`1` AS `1` from (/* select#2 */ select 1 AS `1` union all /* select#3 */ select 1 AS `1`) `__4`
select 1 union select 1 union all select 1;
1
1
1
explain extended
select 1 union select 1 union all select 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union1,2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 /* select#1 */ select 1 AS `1` union /* select#2 */ select 1 AS `1` union all /* select#3 */ select 1 AS `1`
(select 1 as a) union (select 2) order by a;
a
1
2
explain extended
(select 1 as a) union (select 2) order by a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
Warnings:
Note 1003 (/* select#1 */ select 1 AS `a`) union (/* select#2 */ select 2 AS `2`) order by `a`
/* select#1 */ select 1 AS `a` union /* select#2 */ select 2 AS `2` order by `a`;
a
1
2
explain extended
/* select#1 */ select 1 AS `a` union /* select#2 */ select 2 AS `2` order by `a`;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
Warnings:
Note 1003 /* select#1 */ select 1 AS `a` union /* select#2 */ select 2 AS `2` order by `a`
select 1 union ( select 1 union (select 1 union (select 1 union select 1)));
1
1
explain extended all
select 1 union ( select 1 union (select 1 union (select 1 union select 1)));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
8 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
7 UNION <derived3> ALL NULL NULL NULL NULL 2 100.00
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
6 UNION <derived4> ALL NULL NULL NULL NULL 2 100.00
4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
5 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union3,6> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union2,7> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union1,8> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 /* select#1/0 Filter Select: select `1` AS `1` */ select 1 AS `1` union /* select#8/0 */ select `__8`.`1` AS `1` from (/* select#2/1 Filter Select: select `1` AS `1` */ select 1 AS `1` union /* select#7/1 */ select `__7`.`1` AS `1` from (/* select#3/2 Filter Select: select `1` AS `1` */ select 1 AS `1` union /* select#6/2 */ select `__6`.`1` AS `1` from (/* select#4/3 Filter Select: select `1` AS `1` */ select 1 AS `1` union /* select#5/3 */ select 1 AS `1`) `__6`) `__7`) `__8`
#
# MDEV-6341: INSERT ... SELECT UNION with parenthesis
#
create table t1 (a int, b int);
insert into t1 (select 1,1 union select 2,2);
select * from t1 order by 1;
a b
1 1
2 2
delete from t1;
insert into t1 select 1,1 union select 2,2;
select * from t1 order by 1;
a b
1 1
2 2
drop table t1;
CREATE OR REPLACE TABLE t1 AS SELECT 1 AS a UNION SELECT 2;
select * from t1 order by 1;
a
1
2
drop table t1;
CREATE OR REPLACE TABLE t1 AS (SELECT 1 AS a UNION SELECT 2);
select * from t1 order by 1;
a
1
2
drop table t1;
CREATE OR REPLACE VIEW v1 AS (SELECT 1 AS a);
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select 1 AS `a`) latin1 latin1_swedish_ci
drop view v1;
CREATE OR REPLACE VIEW v1 AS SELECT 1 AS a UNION SELECT 2;
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `a` union select 2 AS `2` latin1 latin1_swedish_ci
drop view v1;
CREATE OR REPLACE VIEW v1 AS (SELECT 1 AS a UNION SELECT 2);
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `a` union select 2 AS `2` latin1 latin1_swedish_ci
drop view v1;
#
# MDEV-10028: Syntax error on ((SELECT ...) UNION (SELECT ...))
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (10);
INSERT INTO t1 VALUES (20);
INSERT INTO t1 VALUES (30);
((SELECT a FROM t1) UNION (SELECT a FROM t1));
a
10
20
30
(SELECT * FROM t1 UNION SELECT * FROM t1);
a
10
20
30
((SELECT a FROM t1) LIMIT 1);
a
10
SELECT * FROM (SELECT 1 UNION (SELECT 2 UNION SELECT 3)) t1;
1
1
2
3
DROP TABLE t1;
#
# test of several levels of ORDER BY / LIMIT
#
create table t1 (a int, b int);
insert into t1 (a,b) values (1, 100), (2, 200), (3,30), (4,4);
select a,b from t1 order by 1 limit 3;
a b
1 100
2 200
3 30
(select a,b from t1 order by 1 limit 3) order by 2 limit 2;
a b
3 30
1 100
(select 10,1000 union select a,b from t1 order by 1 limit 3) order by 2 limit 2;
10 1000
3 30
1 100
((select a,b from t1 order by 1 limit 3) order by 2 limit 2) order by 1 limit 1;
a b
1 100
((select a,b from t1 order by 1 limit 3) order by 2 limit 2) order by 1;
a b
1 100
3 30
drop table t1;
# End of 10.4 tests

View File

@ -0,0 +1,84 @@
select 1 union ( select 2 union select 3);
explain extended
select 1 union ( select 2 union select 3);
select 1 union ( select 1 union select 1);
explain extended
select 1 union ( select 1 union select 1);
select 1 union all ( select 1 union select 1);
explain extended
select 1 union all ( select 1 union select 1);
select 1 union ( select 1 union all select 1);
explain extended
select 1 union ( select 1 union all select 1);
select 1 union select 1 union all select 1;
explain extended
select 1 union select 1 union all select 1;
(select 1 as a) union (select 2) order by a;
explain extended
(select 1 as a) union (select 2) order by a;
/* select#1 */ select 1 AS `a` union /* select#2 */ select 2 AS `2` order by `a`;
explain extended
/* select#1 */ select 1 AS `a` union /* select#2 */ select 2 AS `2` order by `a`;
select 1 union ( select 1 union (select 1 union (select 1 union select 1)));
explain extended all
select 1 union ( select 1 union (select 1 union (select 1 union select 1)));
--echo #
--echo # MDEV-6341: INSERT ... SELECT UNION with parenthesis
--echo #
create table t1 (a int, b int);
insert into t1 (select 1,1 union select 2,2);
select * from t1 order by 1;
delete from t1;
insert into t1 select 1,1 union select 2,2;
select * from t1 order by 1;
drop table t1;
CREATE OR REPLACE TABLE t1 AS SELECT 1 AS a UNION SELECT 2;
select * from t1 order by 1;
drop table t1;
CREATE OR REPLACE TABLE t1 AS (SELECT 1 AS a UNION SELECT 2);
select * from t1 order by 1;
drop table t1;
CREATE OR REPLACE VIEW v1 AS (SELECT 1 AS a);
show create view v1;
drop view v1;
CREATE OR REPLACE VIEW v1 AS SELECT 1 AS a UNION SELECT 2;
show create view v1;
drop view v1;
CREATE OR REPLACE VIEW v1 AS (SELECT 1 AS a UNION SELECT 2);
show create view v1;
drop view v1;
--echo #
--echo # MDEV-10028: Syntax error on ((SELECT ...) UNION (SELECT ...))
--echo #
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (10);
INSERT INTO t1 VALUES (20);
INSERT INTO t1 VALUES (30);
((SELECT a FROM t1) UNION (SELECT a FROM t1));
(SELECT * FROM t1 UNION SELECT * FROM t1);
((SELECT a FROM t1) LIMIT 1);
SELECT * FROM (SELECT 1 UNION (SELECT 2 UNION SELECT 3)) t1;
DROP TABLE t1;
--echo #
--echo # test of several levels of ORDER BY / LIMIT
--echo #
create table t1 (a int, b int);
insert into t1 (a,b) values (1, 100), (2, 200), (3,30), (4,4);
select a,b from t1 order by 1 limit 3;
(select a,b from t1 order by 1 limit 3) order by 2 limit 2;
(select 10,1000 union select a,b from t1 order by 1 limit 3) order by 2 limit 2;
((select a,b from t1 order by 1 limit 3) order by 2 limit 2) order by 1 limit 1;
((select a,b from t1 order by 1 limit 3) order by 2 limit 2) order by 1;
drop table t1;
--echo # End of 10.4 tests

View File

@ -16,6 +16,8 @@ create table t10 (c1 int);
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
into @count_read_before; into @count_read_before;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
show tables; show tables;
Tables_in_show_table_lw_db Tables_in_show_table_lw_db
t1 t1
@ -31,6 +33,8 @@ t9
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
into @count_read_after; into @count_read_after;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
select @count_read_after-@count_read_before; select @count_read_after-@count_read_before;
@count_read_after-@count_read_before @count_read_after-@count_read_before
0.00000000000000000000000000000000000000 0.00000000000000000000000000000000000000
@ -49,6 +53,8 @@ t9 BASE TABLE
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
into @count_read_after; into @count_read_after;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
select @count_read_after-@count_read_before; select @count_read_after-@count_read_before;
@count_read_after-@count_read_before @count_read_after-@count_read_before
10.00000000000000000000000000000000000000 10.00000000000000000000000000000000000000

View File

@ -418,10 +418,10 @@ t2.c in (with t as (select * from t1 where t1.a<5)
select t2.c from t2,t where t2.c=t.a); select t2.c from t2,t where t2.c=t.a);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 1 PRIMARY t2 ALL NULL NULL NULL NULL 4
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where 3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) 3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
explain explain
select t1.a,t1.b from t1,t2 select t1.a,t1.b from t1,t2
where t1.a>t2.c and where t1.a>t2.c and
@ -461,10 +461,10 @@ t.c in (with t as (select * from t1 where t1.a<5)
select t2.c from t2,t where t2.c=t.a); select t2.c from t2,t where t2.c=t.a);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where 1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 func 1
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where 4 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) 4 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
explain explain
select t1.a,t1.b from t1, (select c from t2 where c >= 4) as t select t1.a,t1.b from t1, (select c from t2 where c >= 4) as t
where t1.a=t.c and where t1.a=t.c and
@ -507,9 +507,9 @@ select t.a, count(*) from t1,t where t1.a=t.a group by t.a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 35 func 1 1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 35 func 1
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where 4 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) 4 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
explain explain
select t.a, count(*) select t.a, count(*)
from t1, from t1,
@ -597,8 +597,8 @@ explain
select * from v2; select * from v2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where 1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
1 PRIMARY <derived3> ref key0 key0 5 test.t2.c 2 1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
# with clause in the specification of a view that whose definition # with clause in the specification of a view that whose definition
# table alias for a with table # table alias for a with table
create view v3 as create view v3 as
@ -863,8 +863,8 @@ SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT 1) AS t1;
1 1
EXPLAIN SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT 1) AS t1; EXPLAIN SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT 1) AS t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 1 PRIMARY <derived3> system NULL NULL NULL NULL 1
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-10058: Suspicious EXPLAIN output for a derived table + WITH + joined table # MDEV-10058: Suspicious EXPLAIN output for a derived table + WITH + joined table
@ -1116,17 +1116,17 @@ select * from cte_e as cte_e1 where a > 1
union union
select * from cte_e as cte_e2; select * from cte_e as cte_e2;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 14 100.00 Using where 1 PRIMARY <derived4> ALL NULL NULL NULL NULL 14 100.00 Using where
2 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where 4 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where
5 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where 5 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where
NULL UNION RESULT <union2,5> ALL NULL NULL NULL NULL NULL NULL NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL
6 UNION <derived9> ALL NULL NULL NULL NULL 14 100.00 6 UNION <derived11> ALL NULL NULL NULL NULL 14 100.00
9 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where 11 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where
12 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where 12 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where
NULL UNION RESULT <union9,12> ALL NULL NULL NULL NULL NULL NULL NULL UNION RESULT <union11,12> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL
Warnings: Warnings:
Note 1003 with cte_e as (with cte_o as (with cte_i as (/* select#4 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)/* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union /* select#5 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)/* select#1 */ select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union /* select#6 */ select `cte_e2`.`a` AS `a` from (with cte_o as (with cte_i as (/* select#11 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)/* select#10 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)/* select#9 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 union /* select#12 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7) `cte_e2` Note 1003 with cte_e as (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union select `cte_e2`.`a` AS `a` from (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7) `cte_e2`
drop table t1; drop table t1;
# #
# MDEV-13753: embedded CTE in a VIEW created in prepared statement # MDEV-13753: embedded CTE in a VIEW created in prepared statement

View File

@ -480,7 +480,11 @@ b MEDIUMTEXT CHARACTER SET big5);
INSERT INTO t1 VALUES INSERT INTO t1 VALUES
(REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', ''); (REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', '');
SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
DROP TABLES t1; DROP TABLES t1;
End of 5.0 tests End of 5.0 tests
# #

View File

@ -207,6 +207,8 @@ DROP TABLE t1;
# Problem # 1 (original report): wrong parsing of ucs2 data # Problem # 1 (original report): wrong parsing of ucs2 data
SET character_set_connection=ucs2; SET character_set_connection=ucs2;
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CREATE TABLE t1(a INT); CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b); (@b) SET a=REVERSE(@b);
@ -218,6 +220,8 @@ a
DROP TABLE t1; DROP TABLE t1;
# Problem # 2 : if you write and read ucs2 data to a file they're lost # Problem # 2 : if you write and read ucs2 data to a file they're lost
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CREATE TABLE t1(a INT); CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b); (@b) SET a=REVERSE(@b);

View File

@ -72,7 +72,7 @@ insert into t1 values(0, 0), (300, 300);
insert into t2 values(0, 0), (1, 20), (2, 30); insert into t2 values(0, 0), (1, 20), (2, 30);
commit; commit;
connection con1; connection con1;
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE; select a,b from t2 UNION (SELECT id, x from t1 FOR UPDATE);
a b a b
0 0 0 0
20 1 20 1

View File

@ -8935,7 +8935,7 @@ EXPLAIN
"access_type": "ALL", "access_type": "ALL",
"rows": 18, "rows": 18,
"filtered": 100, "filtered": 100,
"attached_condition": "__3.a > 5 and __3.c > 200", "attached_condition": "__5.a > 5 and __5.c > 200",
"materialized": { "materialized": {
"query_block": { "query_block": {
"union_result": { "union_result": {
@ -9561,7 +9561,7 @@ EXPLAIN
"access_type": "ALL", "access_type": "ALL",
"rows": 18, "rows": 18,
"filtered": 100, "filtered": 100,
"attached_condition": "__3.a > 4 and __3.c < 130", "attached_condition": "__5.a > 4 and __5.c < 130",
"materialized": { "materialized": {
"query_block": { "query_block": {
"union_result": { "union_result": {
@ -9707,7 +9707,7 @@ EXPLAIN
"access_type": "ALL", "access_type": "ALL",
"rows": 18, "rows": 18,
"filtered": 100, "filtered": 100,
"attached_condition": "__3.a > 4 and __3.c < 130", "attached_condition": "__6.a > 4 and __6.c < 130",
"materialized": { "materialized": {
"query_block": { "query_block": {
"union_result": { "union_result": {
@ -15948,7 +15948,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DERIVED a2 eq_ref PRIMARY PRIMARY 4 a1.f 1 100.00 Using index 2 DERIVED a2 eq_ref PRIMARY PRIMARY 4 a1.f 1 100.00 Using index
4 DERIVED t1 index PRIMARY PRIMARY 4 NULL 7 100.00 Using index; Using temporary; Using filesort 4 DERIVED t1 index PRIMARY PRIMARY 4 NULL 7 100.00 Using index; Using temporary; Using filesort
Warnings: Warnings:
Note 1003 /* select#1 */ select `s`.`f` AS `f`,`s`.`c` AS `c` from (/* select#2 */ select straight_join `a2`.`f` AS `f`,count(0) AS `c` from ((/* select#4 */ select `test`.`t1`.`f` AS `f`,count(0) AS `c` from `test`.`t1` group by `test`.`t1`.`f`)) `a1` join `test`.`t1` `a2` where `a2`.`f` = `a1`.`f` group by `a2`.`f`) `s` Note 1003 /* select#1 */ select `s`.`f` AS `f`,`s`.`c` AS `c` from (/* select#2 */ select straight_join `a2`.`f` AS `f`,count(0) AS `c` from (/* select#4 */ select `test`.`t1`.`f` AS `f`,count(0) AS `c` from `test`.`t1` group by `test`.`t1`.`f`) `a1` join `test`.`t1` `a2` where `a2`.`f` = `a1`.`f` group by `a2`.`f`) `s`
SELECT * FROM ( SELECT STRAIGHT_JOIN f, COUNT(*) as c FROM v1 GROUP BY f ) AS s; SELECT * FROM ( SELECT STRAIGHT_JOIN f, COUNT(*) as c FROM v1 GROUP BY f ) AS s;
f c f c
1 1 1 1

View File

@ -24,7 +24,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 EXCEPT t2 ALL NULL NULL NULL NULL 2 100.00 3 EXCEPT t2 ALL NULL NULL NULL NULL 2 100.00
NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL NULL NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings: Warnings:
Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) except (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`)) `a` Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from (/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` except (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`)) `a`
EXPLAIN format=json (select a,b from t1) except (select c,d from t2); EXPLAIN format=json (select a,b from t1) except (select c,d from t2);
EXPLAIN EXPLAIN
{ {
@ -229,7 +229,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 EXCEPT t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) 3 EXCEPT t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL NULL NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings: Warnings:
Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b`,`a`.`e` AS `e`,`a`.`f` AS `f` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` join `test`.`t3`) except (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t4`.`g` AS `g`,`test`.`t4`.`h` AS `h` from `test`.`t2` join `test`.`t4`)) `a` Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b`,`a`.`e` AS `e`,`a`.`f` AS `f` from (/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` join `test`.`t3` except (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t4`.`g` AS `g`,`test`.`t4`.`h` AS `h` from `test`.`t2` join `test`.`t4`)) `a`
EXPLAIN format=json (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4); EXPLAIN format=json (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4);
EXPLAIN EXPLAIN
{ {
@ -500,7 +500,7 @@ a
(select 1 from dual) except (select 1 from dual); (select 1 from dual) except (select 1 from dual);
1 1
(select 1 from dual into @v) except (select 1 from dual); (select 1 from dual into @v) except (select 1 from dual);
ERROR HY000: Incorrect usage of EXCEPT and INTO 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 'into @v) except (select 1 from dual)' at line 1
select 1 from dual ORDER BY 1 except select 1 from dual; select 1 from dual ORDER BY 1 except select 1 from dual;
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 'except select 1 from dual' at line 1 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 'except select 1 from dual' at line 1
select 1 as a from dual union all select 1 from dual; select 1 as a from dual union all select 1 from dual;
@ -508,7 +508,7 @@ a
1 1
1 1
select 1 from dual except all select 1 from dual; select 1 from dual except all select 1 from dual;
ERROR HY000: Incorrect usage of EXCEPT and ALL 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 'all select 1 from dual' at line 1
create table t1 (a int, b blob, a1 int, b1 blob) engine=MyISAM; create table t1 (a int, b blob, a1 int, b1 blob) engine=MyISAM;
create table t2 (c int, d blob, c1 int, d1 blob) engine=MyISAM; create table t2 (c int, d blob, c1 int, d1 blob) engine=MyISAM;
insert into t1 values (1,"ddd", 1, "sdfrrwwww"),(2, "fgh", 2, "dffggtt"); insert into t1 values (1,"ddd", 1, "sdfrrwwww"),(2, "fgh", 2, "dffggtt");

View File

@ -60,13 +60,13 @@ drop tables t1,t2,t3,t4;
select 1 as a from dual except select 1 from dual; select 1 as a from dual except select 1 from dual;
(select 1 from dual) except (select 1 from dual); (select 1 from dual) except (select 1 from dual);
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
(select 1 from dual into @v) except (select 1 from dual); (select 1 from dual into @v) except (select 1 from dual);
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
select 1 from dual ORDER BY 1 except select 1 from dual; select 1 from dual ORDER BY 1 except select 1 from dual;
select 1 as a from dual union all select 1 from dual; select 1 as a from dual union all select 1 from dual;
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
select 1 from dual except all select 1 from dual; select 1 from dual except all select 1 from dual;

View File

@ -126,7 +126,7 @@ group by
a.text, b.id, b.betreff a.text, b.id, b.betreff
order by order by
match(b.betreff) against ('+abc' in boolean mode) desc; match(b.betreff) against ('+abc' in boolean mode) desc;
ERROR 42000: Table 'b' from one of the SELECTs cannot be used in field list ERROR 42000: Table 'b' from one of the SELECTs cannot be used in ORDER clause
select a.text, b.id, b.betreff select a.text, b.id, b.betreff
from from
t2 a inner join t3 b on a.id = b.forum inner join t2 a inner join t3 b on a.id = b.forum inner join
@ -142,7 +142,7 @@ where
match(c.beitrag) against ('+abc' in boolean mode) match(c.beitrag) against ('+abc' in boolean mode)
order by order by
match(b.betreff) against ('+abc' in boolean mode) desc; match(b.betreff) against ('+abc' in boolean mode) desc;
ERROR 42000: Table 'b' from one of the SELECTs cannot be used in field list ERROR 42000: Table 'b' from one of the SELECTs cannot be used in ORDER clause
select a.text, b.id, b.betreff select a.text, b.id, b.betreff
from from
t2 a inner join t3 b on a.id = b.forum inner join t2 a inner join t3 b on a.id = b.forum inner join

View File

@ -153,13 +153,19 @@ End of 5.1 tests
# Start of 10.2 tests # Start of 10.2 tests
# #
(SELECT 1 FROM DUAL PROCEDURE ANALYSE()); (SELECT 1 FROM DUAL PROCEDURE ANALYSE());
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype 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 'PROCEDURE ANALYSE())' at line 1
1 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
((SELECT 1 FROM DUAL PROCEDURE ANALYSE())); ((SELECT 1 FROM DUAL PROCEDURE ANALYSE()));
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 'PROCEDURE ANALYSE()))' at line 1
(SELECT 1 FROM DUAL) PROCEDURE ANALYSE();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
1 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL 1 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
((SELECT 1 FROM DUAL)) PROCEDURE ANALYSE();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
1 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
create table t1 (a int);
SELECT * FROM t1 UNION SELECT * FROM t1 PROCEDURE analyse(); SELECT * FROM t1 UNION SELECT * FROM t1 PROCEDURE analyse();
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 'PROCEDURE analyse()' at line 1 ERROR 42000: Incorrect usage/placement of 'PROCEDURE'
drop table t1;
# #
# MDEV-10030 sql_yacc.yy: Split table_expression and remove PROCEDURE from create_select, select_paren_derived, select_derived2, query_specification # MDEV-10030 sql_yacc.yy: Split table_expression and remove PROCEDURE from create_select, select_paren_derived, select_derived2, query_specification
# #

View File

@ -161,12 +161,17 @@ DROP TABLE t1, t2;
--echo # --echo #
--echo # Start of 10.2 tests --echo # Start of 10.2 tests
--echo # --echo #
(SELECT 1 FROM DUAL PROCEDURE ANALYSE());
((SELECT 1 FROM DUAL PROCEDURE ANALYSE()));
# TODO:
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
(SELECT 1 FROM DUAL PROCEDURE ANALYSE());
--error ER_PARSE_ERROR
((SELECT 1 FROM DUAL PROCEDURE ANALYSE()));
(SELECT 1 FROM DUAL) PROCEDURE ANALYSE();
((SELECT 1 FROM DUAL)) PROCEDURE ANALYSE();
create table t1 (a int);
--error ER_CANT_USE_OPTION_HERE
SELECT * FROM t1 UNION SELECT * FROM t1 PROCEDURE analyse(); SELECT * FROM t1 UNION SELECT * FROM t1 PROCEDURE analyse();
drop table t1;
--echo # --echo #
--echo # MDEV-10030 sql_yacc.yy: Split table_expression and remove PROCEDURE from create_select, select_paren_derived, select_derived2, query_specification --echo # MDEV-10030 sql_yacc.yy: Split table_expression and remove PROCEDURE from create_select, select_paren_derived, select_derived2, query_specification

View File

@ -3526,13 +3526,21 @@ SET @sav_slow_query_log= @@session.slow_query_log;
SET @@session.slow_query_log= ON; SET @@session.slow_query_log= ON;
SELECT current_timestamp(6),fn_sleep_before_now() INTO @ts_cur, @ts_func; SELECT current_timestamp(6),fn_sleep_before_now() INTO @ts_cur, @ts_func;
SELECT a FROM t_ts LIMIT 1 into @ts_func; SELECT a FROM t_ts LIMIT 1 into @ts_func;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
SELECT a FROM t_trig LIMIT 1 into @ts_trig; SELECT a FROM t_trig LIMIT 1 into @ts_trig;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
DELETE FROM t_ts; DELETE FROM t_ts;
DELETE FROM t_trig; DELETE FROM t_trig;
SET @@session.slow_query_log= OFF; SET @@session.slow_query_log= OFF;
SELECT current_timestamp(6),fn_sleep_before_now() INTO @ts_cur, @func_ts; SELECT current_timestamp(6),fn_sleep_before_now() INTO @ts_cur, @func_ts;
SELECT a FROM t_ts LIMIT 1 into @ts_func; SELECT a FROM t_ts LIMIT 1 into @ts_func;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
SELECT a FROM t_trig LIMIT 1 into @ts_trig; SELECT a FROM t_trig LIMIT 1 into @ts_trig;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
SET @@session.slow_query_log= @sav_slow_query_log; SET @@session.slow_query_log= @sav_slow_query_log;
DROP FUNCTION fn_sleep_before_now; DROP FUNCTION fn_sleep_before_now;
DROP TRIGGER trg_insert_t_ts; DROP TRIGGER trg_insert_t_ts;

View File

@ -133,7 +133,7 @@ DROP PROCEDURE p1;
GET DIAGNOSTICS CONDITION; GET DIAGNOSTICS CONDITION;
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 '' at line 1 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 '' at line 1
GET DIAGNOSTICS CONDITION a; GET DIAGNOSTICS CONDITION 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 '' at line 1 ERROR 42S22: Unknown column 'a' in 'field list'
GET DIAGNOSTICS CONDITION 1; GET DIAGNOSTICS CONDITION 1;
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 '' at line 1 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 '' at line 1
GET DIAGNOSTICS CONDITION 1 @var; GET DIAGNOSTICS CONDITION 1 @var;
@ -212,9 +212,9 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
GET DIAGNOSTICS CONDITION (1) @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION (1) @var = CLASS_ORIGIN;
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 '(1) @var = CLASS_ORIGIN' at line 1 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 '(1) @var = CLASS_ORIGIN' at line 1
GET DIAGNOSTICS CONDITION p1() @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION p1() @var = CLASS_ORIGIN;
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 '() @var = CLASS_ORIGIN' at line 1 ERROR 42S22: Unknown column 'p1' in 'field list'
GET DIAGNOSTICS CONDITION ABS(2) @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION ABS(2) @var = CLASS_ORIGIN;
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 '(2) @var = CLASS_ORIGIN' at line 1 ERROR 42S22: Unknown column 'ABS' in 'field list'
GET DIAGNOSTICS CONDITION 1.1 @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION 1.1 @var = CLASS_ORIGIN;
GET DIAGNOSTICS CONDITION "1" @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION "1" @var = CLASS_ORIGIN;
SELECT COUNT(max_questions) INTO @var FROM mysql.user; SELECT COUNT(max_questions) INTO @var FROM mysql.user;
@ -226,10 +226,7 @@ Warnings:
Error 1758 Invalid condition number Error 1758 Invalid condition number
Error 1758 Invalid condition number Error 1758 Invalid condition number
GET DIAGNOSTICS CONDITION a @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION a @var = CLASS_ORIGIN;
Warnings: ERROR 42S22: Unknown column 'a' in 'field list'
Error 1758 Invalid condition number
Error 1758 Invalid condition number
Error 1054 Unknown column 'a' in 'field list'
SELECT COUNT(max_questions) INTO @var FROM mysql.user; SELECT COUNT(max_questions) INTO @var FROM mysql.user;
SET @cond = 1; SET @cond = 1;
GET DIAGNOSTICS CONDITION @cond @var1 = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION @cond @var1 = CLASS_ORIGIN;

View File

@ -169,7 +169,7 @@ DROP PROCEDURE p1;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
GET DIAGNOSTICS CONDITION; GET DIAGNOSTICS CONDITION;
--error ER_PARSE_ERROR --error ER_BAD_FIELD_ERROR
GET DIAGNOSTICS CONDITION a; GET DIAGNOSTICS CONDITION a;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
GET DIAGNOSTICS CONDITION 1; GET DIAGNOSTICS CONDITION 1;
@ -271,9 +271,9 @@ GET DIAGNOSTICS CONDITION 1+1 @var = CLASS_ORIGIN;
GET DIAGNOSTICS CONDITION ? @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION ? @var = CLASS_ORIGIN;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
GET DIAGNOSTICS CONDITION (1) @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION (1) @var = CLASS_ORIGIN;
--error ER_PARSE_ERROR --error ER_BAD_FIELD_ERROR
GET DIAGNOSTICS CONDITION p1() @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION p1() @var = CLASS_ORIGIN;
--error ER_PARSE_ERROR --error ER_BAD_FIELD_ERROR
GET DIAGNOSTICS CONDITION ABS(2) @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION ABS(2) @var = CLASS_ORIGIN;
# Unfortunate side effects... # Unfortunate side effects...
@ -285,6 +285,7 @@ SELECT COUNT(max_questions) INTO @var FROM mysql.user;
GET DIAGNOSTICS CONDITION 9999 @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION 9999 @var = CLASS_ORIGIN;
GET DIAGNOSTICS CONDITION NULL @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION NULL @var = CLASS_ORIGIN;
--error ER_BAD_FIELD_ERROR
GET DIAGNOSTICS CONDITION a @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION a @var = CLASS_ORIGIN;
# Reset warnings # Reset warnings

View File

@ -1440,6 +1440,8 @@ declare tmp varchar(30);
select col1 from test limit 1 into tmp; select col1 from test limit 1 into tmp;
return '1'; return '1';
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create view v1 as select test.* from test where test.col1=test_function(); create view v1 as select test.* from test where test.col1=test_function();
grant update (col1) on v1 to 'greg'@'localhost'; grant update (col1) on v1 to 'greg'@'localhost';
drop user 'greg'@'localhost'; drop user 'greg'@'localhost';

View File

@ -462,6 +462,8 @@ INSERT INTO t2 VALUES (1);
DROP FUNCTION IF EXISTS f2; DROP FUNCTION IF EXISTS f2;
CREATE FUNCTION f2 () RETURNS INT CREATE FUNCTION f2 () RETURNS INT
BEGIN DECLARE v INT; SELECT s1 FROM t2 INTO v; RETURN v; END// BEGIN DECLARE v INT; SELECT s1 FROM t2 INTO v; RETURN v; END//
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
SELECT f2(); SELECT f2();
f2() f2()
1 1
@ -554,6 +556,8 @@ USE mysql;
SELECT LEFT(CURRENT_USER(),INSTR(CURRENT_USER(),'@')-1) INTO @u; SELECT LEFT(CURRENT_USER(),INSTR(CURRENT_USER(),'@')-1) INTO @u;
SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h; SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h;
SELECT password FROM user WHERE user=@u AND host=@h INTO @pwd; SELECT password FROM user WHERE user=@u AND host=@h INTO @pwd;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h; SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
user host password insert_priv user host password insert_priv
root localhost Y root localhost Y

View File

@ -26,6 +26,8 @@ declare ret_val int;
select max(f1) from t1 into ret_val; select max(f1) from t1 into ret_val;
return ret_val; return ret_val;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create view v1 as select f1 from t1 where f1 = func1(f1); create view v1 as select f1 from t1 where f1 = func1(f1);
create function func2() returns int return 1; create function func2() returns int return 1;
use mbase; use mbase;

View File

@ -57,6 +57,8 @@ declare j int;
select i from t1 where i = 1 into j; select i from t1 where i = 1 into j;
return j; return j;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create function f2() returns int create function f2() returns int
begin begin
declare k int; declare k int;
@ -64,6 +66,8 @@ select i from t1 where i = 1 into k;
insert into t2 values (k + 5); insert into t2 values (k + 5);
return 0; return 0;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create function f3() returns int create function f3() returns int
begin begin
return (select i from t1 where i = 3); return (select i from t1 where i = 3);
@ -87,12 +91,16 @@ declare k int;
select i from v1 where i = 1 into k; select i from v1 where i = 1 into k;
return k; return k;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create function f7() returns int create function f7() returns int
begin begin
declare k int; declare k int;
select j from v2 where j = 1 into k; select j from v2 where j = 1 into k;
return k; return k;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create function f8() returns int create function f8() returns int
begin begin
declare k int; declare k int;
@ -100,6 +108,8 @@ select i from v1 where i = 1 into k;
insert into t2 values (k+5); insert into t2 values (k+5);
return k; return k;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create function f9() returns int create function f9() returns int
begin begin
update v2 set j=j+10 where j=1; update v2 set j=j+10 where j=1;
@ -129,6 +139,8 @@ create procedure p2(inout p int)
begin begin
select i from t1 where i = 1 into p; select i from t1 where i = 1 into p;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create function f14() returns int create function f14() returns int
begin begin
declare k int; declare k int;
@ -148,6 +160,8 @@ declare k int;
select i from t1 where i=1 into k; select i from t1 where i=1 into k;
set new.l= k+1; set new.l= k+1;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create trigger t4_bu before update on t4 for each row create trigger t4_bu before update on t4 for each row
begin begin
if (select i from t1 where i=1) then if (select i from t1 where i=1) then

View File

@ -37,7 +37,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 INTERSECT t3 ALL NULL NULL NULL NULL 3 100.00 4 INTERSECT t3 ALL NULL NULL NULL NULL 3 100.00
NULL INTERSECT RESULT <intersect2,3,4> ALL NULL NULL NULL NULL NULL NULL NULL INTERSECT RESULT <intersect2,3,4> ALL NULL NULL NULL NULL NULL NULL
Warnings: Warnings:
Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (/* select#4 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `a` Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from (/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` intersect (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (/* select#4 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `a`
EXPLAIN format=json (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3); EXPLAIN format=json (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);
EXPLAIN EXPLAIN
{ {
@ -278,7 +278,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 INTERSECT t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) 3 INTERSECT t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings: Warnings:
Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t3`.`e` AS `e` from `test`.`t2` join `test`.`t3`)) `a` Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from (/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` intersect (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t3`.`e` AS `e` from `test`.`t2` join `test`.`t3`)) `a`
EXPLAIN format=json (select a,b from t1) intersect (select c,e from t2,t3); EXPLAIN format=json (select a,b from t1) intersect (select c,e from t2,t3);
EXPLAIN EXPLAIN
{ {
@ -497,7 +497,7 @@ a
1 1
1 1
(select 1 from dual into @v) intersect (select 1 from dual); (select 1 from dual into @v) intersect (select 1 from dual);
ERROR HY000: Incorrect usage of INTERSECT and INTO 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 'into @v) intersect (select 1 from dual)' at line 1
select 1 from dual ORDER BY 1 intersect select 1 from dual; select 1 from dual ORDER BY 1 intersect select 1 from dual;
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 'intersect select 1 from dual' at line 1 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 'intersect select 1 from dual' at line 1
select 1 as a from dual union all select 1 from dual; select 1 as a from dual union all select 1 from dual;
@ -505,7 +505,7 @@ a
1 1
1 1
select 1 from dual intersect all select 1 from dual; select 1 from dual intersect all select 1 from dual;
ERROR HY000: Incorrect usage of INTERSECT and ALL 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 'all select 1 from dual' at line 1
create table t1 (a int, b blob, a1 int, b1 blob); create table t1 (a int, b blob, a1 int, b1 blob);
create table t2 (c int, d blob, c1 int, d1 blob); create table t2 (c int, d blob, c1 int, d1 blob);
insert into t1 values (1,"ddd", 1, "sdfrrwwww"),(2, "fgh", 2, "dffggtt"); insert into t1 values (1,"ddd", 1, "sdfrrwwww"),(2, "fgh", 2, "dffggtt");
@ -599,14 +599,14 @@ explain extended
(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4); (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 id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
3 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 5 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00
4 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00 3 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00
NULL INTERSECT RESULT <intersect2,4> ALL NULL NULL NULL NULL NULL NULL NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL
5 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used 4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union1,3,5> ALL NULL NULL NULL NULL NULL NULL NULL UNION RESULT <union1,5,4> ALL NULL NULL NULL NULL NULL NULL
Warnings: Warnings:
Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union /* select#3 */ select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (/* select#4 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (/* select#5 */ select 4 AS `4`,4 AS `4`) Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union /* select#5 */ select `__5`.`c` AS `c`,`__5`.`d` AS `d` from ((/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (/* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__5` union (/* select#4 */ select 4 AS `4`,4 AS `4`)
set SQL_MODE=ORACLE; 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); (select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
a b a b
@ -720,7 +720,7 @@ a b
drop procedure p1; drop procedure p1;
show create view v1; show create view v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (select 4 AS `4`,4 AS `4`) latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union select `__6`.`c` AS `c`,`__6`.`d` AS `d` from (select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` intersect (select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__6` union (select 4 AS `4`,4 AS `4`) latin1 latin1_swedish_ci
drop view v1; drop view v1;
drop tables t1,t2,t3; drop tables t1,t2,t3;
# #

View File

@ -59,13 +59,13 @@ drop tables t1,t2,t3;
select 1 as a from dual intersect select 1 from dual; select 1 as a from dual intersect select 1 from dual;
(select 1 from dual) intersect (select 1 from dual); (select 1 from dual) intersect (select 1 from dual);
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
(select 1 from dual into @v) intersect (select 1 from dual); (select 1 from dual into @v) intersect (select 1 from dual);
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
select 1 from dual ORDER BY 1 intersect select 1 from dual; select 1 from dual ORDER BY 1 intersect select 1 from dual;
select 1 as a from dual union all select 1 from dual; select 1 as a from dual union all select 1 from dual;
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
select 1 from dual intersect all select 1 from dual; select 1 from dual intersect all select 1 from dual;

View File

@ -559,6 +559,8 @@ DROP TABLE t1;
create or replace table t1 (a int, b int invisible); create or replace table t1 (a int, b int invisible);
insert into t1 values (1),(2); insert into t1 values (1),(2);
select * from t1 into outfile 'f'; select * from t1 into outfile 'f';
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
load data infile 'f' into table t1; load data infile 'f' into table t1;
select a,b from t1; select a,b from t1;
a b a b
@ -589,6 +591,8 @@ a b
truncate table t1; truncate table t1;
insert into t1(a,b) values (1,1),(2,2); insert into t1(a,b) values (1,1),(2,2);
select a,b from t1 into outfile 'a'; select a,b from t1 into outfile 'a';
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
load data infile 'a' into table t1(a,b); load data infile 'a' into table t1(a,b);
select a,b from t1; select a,b from t1;
a b a b

View File

@ -1484,7 +1484,7 @@ DROP TABLE t1,t2,t3,t4,t5;
# MDEV-4752: Segfault during parsing of illegal query # MDEV-4752: Segfault during parsing of illegal query
# #
SELECT * FROM t5 JOIN (t1 JOIN t2 UNION SELECT * FROM t3 JOIN t4); SELECT * FROM t5 JOIN (t1 JOIN t2 UNION SELECT * FROM t3 JOIN t4);
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 'SELECT * FROM t3 JOIN t4)' at line 1 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 'UNION SELECT * FROM t3 JOIN t4)' at line 1
# #
# MDEV-4959: join of const table with NULL fields # MDEV-4959: join of const table with NULL fields
# #

View File

@ -1150,7 +1150,7 @@ a b a b
4 2 2 2 4 2 2 2
5 3 NULL NULL 5 3 NULL NULL
SELECT t2.a,t2.b,t3.a,t3.b SELECT t2.a,t2.b,t3.a,t3.b
FROM t2 LEFT JOIN (t3) ON t2.b=t3.b FROM t2 LEFT JOIN t3 ON t2.b=t3.b
WHERE t2.a = 4 OR (t2.a > 4 AND t3.a IS NULL); WHERE t2.a = 4 OR (t2.a > 4 AND t3.a IS NULL);
a b a b a b a b
4 2 1 2 4 2 1 2

View File

@ -683,7 +683,7 @@ SELECT t2.a,t2.b,t3.a,t3.b
WHERE t2.a = 4 OR (t2.a > 4 AND t3.a IS NULL); WHERE t2.a = 4 OR (t2.a > 4 AND t3.a IS NULL);
SELECT t2.a,t2.b,t3.a,t3.b SELECT t2.a,t2.b,t3.a,t3.b
FROM t2 LEFT JOIN (t3) ON t2.b=t3.b FROM t2 LEFT JOIN t3 ON t2.b=t3.b
WHERE t2.a = 4 OR (t2.a > 4 AND t3.a IS NULL); WHERE t2.a = 4 OR (t2.a > 4 AND t3.a IS NULL);
ALTER TABLE t3 ALTER TABLE t3

View File

@ -1161,7 +1161,7 @@ a b a b
4 2 2 2 4 2 2 2
5 3 NULL NULL 5 3 NULL NULL
SELECT t2.a,t2.b,t3.a,t3.b SELECT t2.a,t2.b,t3.a,t3.b
FROM t2 LEFT JOIN (t3) ON t2.b=t3.b FROM t2 LEFT JOIN t3 ON t2.b=t3.b
WHERE t2.a = 4 OR (t2.a > 4 AND t3.a IS NULL); WHERE t2.a = 4 OR (t2.a > 4 AND t3.a IS NULL);
a b a b a b a b
4 2 1 2 4 2 1 2

View File

@ -67,6 +67,8 @@ declare j int;
select i from t1 where i = 1 into j; select i from t1 where i = 1 into j;
return j; return j;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create function f2() returns int create function f2() returns int
begin begin
declare k int; declare k int;
@ -74,6 +76,8 @@ select i from t1 where i = 1 into k;
insert into t2 values (k + 5); insert into t2 values (k + 5);
return 0; return 0;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create function f3() returns int create function f3() returns int
begin begin
return (select i from t1 where i = 3); return (select i from t1 where i = 3);
@ -97,12 +101,16 @@ declare k int;
select i from v1 where i = 1 into k; select i from v1 where i = 1 into k;
return k; return k;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create function f7() returns int create function f7() returns int
begin begin
declare k int; declare k int;
select j from v2 where j = 1 into k; select j from v2 where j = 1 into k;
return k; return k;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create function f8() returns int create function f8() returns int
begin begin
declare k int; declare k int;
@ -110,6 +118,8 @@ select i from v1 where i = 1 into k;
insert into t2 values (k+5); insert into t2 values (k+5);
return k; return k;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create function f9() returns int create function f9() returns int
begin begin
update v2 set j=j+10 where j=1; update v2 set j=j+10 where j=1;
@ -139,6 +149,8 @@ create procedure p2(inout p int)
begin begin
select i from t1 where i = 1 into p; select i from t1 where i = 1 into p;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create function f14() returns int create function f14() returns int
begin begin
declare k int; declare k int;
@ -166,6 +178,8 @@ select i from t1 where i = 1 into j;
call p3; call p3;
return 1; return 1;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create procedure p3() create procedure p3()
begin begin
create temporary table if not exists temp1 (a int); create temporary table if not exists temp1 (a int);
@ -178,6 +192,8 @@ declare k int;
select i from t1 where i=1 into k; select i from t1 where i=1 into k;
set new.l= k+1; set new.l= k+1;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create trigger t4_bu before update on t4 for each row create trigger t4_bu before update on t4 for each row
begin begin
if (select i from t1 where i=1) then if (select i from t1 where i=1) then

View File

@ -2811,6 +2811,8 @@ CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1)
INSERT_METHOD=LAST; INSERT_METHOD=LAST;
CREATE TRIGGER tm1_ai AFTER INSERT ON tm1 CREATE TRIGGER tm1_ai AFTER INSERT ON tm1
FOR EACH ROW SELECT max(c1) FROM t1 INTO @var; FOR EACH ROW SELECT max(c1) FROM t1 INTO @var;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
LOCK TABLE tm1 WRITE, t1 WRITE; LOCK TABLE tm1 WRITE, t1 WRITE;
INSERT INTO tm1 VALUES (1); INSERT INTO tm1 VALUES (1);
SELECT * FROM tm1; SELECT * FROM tm1;
@ -2835,6 +2837,8 @@ CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2,t3,t4,t5)
INSERT_METHOD=LAST; INSERT_METHOD=LAST;
CREATE TRIGGER t2_au AFTER UPDATE ON t2 CREATE TRIGGER t2_au AFTER UPDATE ON t2
FOR EACH ROW SELECT MAX(c1) FROM t1 INTO @var; FOR EACH ROW SELECT MAX(c1) FROM t1 INTO @var;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CREATE FUNCTION f1() RETURNS INT CREATE FUNCTION f1() RETURNS INT
RETURN (SELECT MAX(c1) FROM t4); RETURN (SELECT MAX(c1) FROM t4);
LOCK TABLE tm1 WRITE, t1 WRITE, t2 WRITE, t3 WRITE, t4 WRITE, t5 WRITE; LOCK TABLE tm1 WRITE, t1 WRITE, t2 WRITE, t3 WRITE, t4 WRITE, t5 WRITE;

View File

@ -23,6 +23,8 @@ SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE = 'wait_in_enable_indexes' AND WHERE STATE = 'wait_in_enable_indexes' AND
INFO = "INSERT INTO t1(id) SELECT id FROM t2" INFO = "INSERT INTO t1(id) SELECT id FROM t2"
INTO @thread_id; INTO @thread_id;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
KILL QUERY @thread_id; KILL QUERY @thread_id;
CHECK TABLE t1; CHECK TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text

File diff suppressed because it is too large Load Diff

View File

@ -2750,6 +2750,8 @@ CREATE PROCEDURE bug9056_proc2(OUT a INT)
BEGIN BEGIN
select sum(id) from t1 into a; select sum(id) from t1 into a;
END // END //
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
set sql_mode='ansi'; set sql_mode='ansi';
create procedure `a'b` () select 1; create procedure `a'b` () select 1;
set sql_mode=''; set sql_mode='';
@ -5161,7 +5163,7 @@ USE BUG52792;
SET NAMES utf8; SET NAMES utf8;
CREATE FUNCTION `straße` ( c1 CHAR(20)) CREATE FUNCTION `straße` ( c1 CHAR(20))
RETURNS CHAR(50) DETERMINISTIC RETURNS CHAR(50) DETERMINISTIC
RETURN CONCAT(']]>, ', s, '!'); RETURN CONCAT(']]>, ', c1, '!');
<?xml version="1.0"?> <?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="BUG52792"> <database name="BUG52792">
@ -5170,7 +5172,7 @@ RETURN CONCAT(']]>, ', s, '!');
<![CDATA[ <![CDATA[
CREATE DEFINER=`root`@`localhost` FUNCTION `straße`( c1 CHAR(20)) RETURNS char(50) CHARSET latin1 CREATE DEFINER=`root`@`localhost` FUNCTION `straße`( c1 CHAR(20)) RETURNS char(50) CHARSET latin1
DETERMINISTIC DETERMINISTIC
RETURN CONCAT(']]]]><![CDATA[>, ', s, '!') RETURN CONCAT(']]]]><![CDATA[>, ', c1, '!')
]]> ]]>
</routine> </routine>
</routines> </routines>

View File

@ -2360,7 +2360,7 @@ USE BUG52792;
SET NAMES utf8; SET NAMES utf8;
CREATE FUNCTION `straße` ( c1 CHAR(20)) CREATE FUNCTION `straße` ( c1 CHAR(20))
RETURNS CHAR(50) DETERMINISTIC RETURNS CHAR(50) DETERMINISTIC
RETURN CONCAT(']]>, ', s, '!'); RETURN CONCAT(']]>, ', c1, '!');
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 -R -X BUG52792 --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 -R -X BUG52792

View File

@ -21,6 +21,10 @@ ALTER TABLE test.t1 RENAME to test.t1_orig;
# Recreated table: test.t1 # Recreated table: test.t1
# Original table: test.t1_orig # Original table: test.t1_orig
include/diff_tables.inc [test.t1, test.t1_orig] include/diff_tables.inc [test.t1, test.t1_orig]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Cleanup # Cleanup
DROP TABLE test.t1, test.t1_orig; DROP TABLE test.t1, test.t1_orig;
# #
@ -46,6 +50,10 @@ ALTER TABLE test.t1 RENAME to test.t1_orig;
# Recreated table: test.t1 # Recreated table: test.t1
# Original table: test.t1_orig # Original table: test.t1_orig
include/diff_tables.inc [test.t1, test.t1_orig] include/diff_tables.inc [test.t1, test.t1_orig]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Cleanup # Cleanup
DROP TABLE test.t1, test.t1_orig; DROP TABLE test.t1, test.t1_orig;
# #
@ -64,6 +72,10 @@ ALTER TABLE test.t1 RENAME to test.t1_orig;
# Recreated table: test.t1 # Recreated table: test.t1
# Original table: test.t1_orig # Original table: test.t1_orig
include/diff_tables.inc [test.t1, test.t1_orig] include/diff_tables.inc [test.t1, test.t1_orig]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Cleanup # Cleanup
DROP TABLE test.t1, test.t1_orig; DROP TABLE test.t1, test.t1_orig;
# #
@ -83,6 +95,10 @@ ALTER TABLE test.t2 RENAME to test.t2_orig;
# Recreated table: test.t2 # Recreated table: test.t2
# Original table: test.t2_orig # Original table: test.t2_orig
include/diff_tables.inc [test.t2, test.t2_orig] include/diff_tables.inc [test.t2, test.t2_orig]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Cleanup # Cleanup
DROP TABLE test.t2, test.t2_orig; DROP TABLE test.t2, test.t2_orig;
DROP TABLE t1; DROP TABLE t1;
@ -101,6 +117,10 @@ ALTER TABLE test.t1 RENAME to test.t1_orig;
# Recreated table: test.t1 # Recreated table: test.t1
# Original table: test.t1_orig # Original table: test.t1_orig
include/diff_tables.inc [test.t1, test.t1_orig] include/diff_tables.inc [test.t1, test.t1_orig]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Cleanup # Cleanup
DROP TABLE test.t1, test.t1_orig; DROP TABLE test.t1, test.t1_orig;
# End tests # End tests

View File

@ -124,16 +124,19 @@ ERROR 42000: Field separator argument is not what is expected; check the manual
# LOAD DATA rises error or has unpredictable result -- to be fixed later # LOAD DATA rises error or has unpredictable result -- to be fixed later
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ENCLOSED BY 'ъ'; SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ENCLOSED BY 'ъ';
Warnings: Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warning 1638 Non-ASCII separator arguments are not fully supported Warning 1638 Non-ASCII separator arguments are not fully supported
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS ENCLOSED BY 'ъ'; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS ENCLOSED BY 'ъ';
ERROR 42000: Field separator argument is not what is expected; check the manual ERROR 42000: Field separator argument is not what is expected; check the manual
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ESCAPED BY 'ъ'; SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ESCAPED BY 'ъ';
Warnings: Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warning 1638 Non-ASCII separator arguments are not fully supported Warning 1638 Non-ASCII separator arguments are not fully supported
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS ESCAPED BY 'ъ'; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS ESCAPED BY 'ъ';
ERROR 42000: Field separator argument is not what is expected; check the manual ERROR 42000: Field separator argument is not what is expected; check the manual
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS TERMINATED BY 'ъ'; SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS TERMINATED BY 'ъ';
Warnings: Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warning 1638 Non-ASCII separator arguments are not fully supported Warning 1638 Non-ASCII separator arguments are not fully supported
################################################## ##################################################
1ъABC-<2D><><EFBFBD>ъDEF-<2D><><EFBFBD> 1ъABC-<2D><><EFBFBD>ъDEF-<2D><><EFBFBD>
@ -157,6 +160,7 @@ a b c
2 NULL NULL 2 NULL NULL
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES STARTING BY 'ъ'; SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES STARTING BY 'ъ';
Warnings: Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warning 1638 Non-ASCII separator arguments are not fully supported Warning 1638 Non-ASCII separator arguments are not fully supported
################################################## ##################################################
ъ1 ABC-<2D><><EFBFBD> DEF-<2D><><EFBFBD> ъ1 ABC-<2D><><EFBFBD> DEF-<2D><><EFBFBD>
@ -172,6 +176,7 @@ a b c
2 NULL NULL 2 NULL NULL
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES TERMINATED BY 'ъ'; SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES TERMINATED BY 'ъ';
Warnings: Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warning 1638 Non-ASCII separator arguments are not fully supported Warning 1638 Non-ASCII separator arguments are not fully supported
################################################## ##################################################
1 ABC-<2D><><EFBFBD> DEF-<2D><><EFBFBD>ъ2 \N \Nъ################################################## 1 ABC-<2D><><EFBFBD> DEF-<2D><><EFBFBD>ъ2 \N \Nъ##################################################

View File

@ -705,6 +705,9 @@ FOR UPDATE;
1 1
1 1
SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
PROCEDURE ANALYSE();
ERROR HY000: Can't use ORDER clause with this procedure
SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
PROCEDURE ANALYSE() FOR UPDATE; PROCEDURE ANALYSE() FOR UPDATE;
ERROR HY000: Can't use ORDER clause with this procedure ERROR HY000: Can't use ORDER clause with this procedure
SELECT 1 FROM SELECT 1 FROM
@ -734,7 +737,7 @@ SELECT 1 FROM t1
UNION UNION
SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
PROCEDURE ANALYSE() FOR UPDATE; PROCEDURE ANALYSE() FOR UPDATE;
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 'PROCEDURE ANALYSE() FOR UPDATE' at line 4 ERROR 42000: Incorrect usage/placement of 'PROCEDURE'
SELECT 1 FROM DUAL PROCEDURE ANALYSE() SELECT 1 FROM DUAL PROCEDURE ANALYSE()
UNION UNION
SELECT 1 FROM t1; SELECT 1 FROM t1;
@ -754,15 +757,18 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
# "FOR UPDATE" tests # "FOR UPDATE" tests
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1; SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
1 1
SELECT 1 FROM t1 FOR UPDATE UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1; (SELECT 1 FROM t1 FOR UPDATE) UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
1 1
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 FOR UPDATE; SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 FOR UPDATE;
1 1
# "INTO" clause tests # "INTO" clause tests
SELECT 1 FROM t1 INTO @var17727401; SELECT 1 FROM t1 INTO @var17727401;
Warnings: Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warning 1329 No data - zero rows fetched, selected, or processed Warning 1329 No data - zero rows fetched, selected, or processed
SELECT 1 FROM DUAL INTO @var17727401; SELECT 1 FROM DUAL INTO @var17727401;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
SELECT 1 INTO @var17727401; SELECT 1 INTO @var17727401;
SELECT 1 INTO @var17727401 FROM t1; SELECT 1 INTO @var17727401 FROM t1;
Warnings: Warnings:
@ -778,6 +784,7 @@ Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed Warning 1329 No data - zero rows fetched, selected, or processed
SELECT 1 FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1 INTO @var17727401; SELECT 1 FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1 INTO @var17727401;
Warnings: Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warning 1329 No data - zero rows fetched, selected, or processed Warning 1329 No data - zero rows fetched, selected, or processed
SELECT 1 FROM t1 WHERE 1 INTO @var17727401 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1; SELECT 1 FROM t1 WHERE 1 INTO @var17727401 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1;
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 'GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1' at line 1 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 'GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1' at line 1
@ -794,31 +801,20 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT 1 FROM t1 INTO @var17727401 UNION SELECT 1 FROM t1 INTO t1; SELECT 1 FROM t1 INTO @var17727401 UNION SELECT 1 FROM t1 INTO t1;
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 'UNION SELECT 1 FROM t1 INTO t1' at line 1 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 'UNION SELECT 1 FROM t1 INTO t1' at line 1
(SELECT 1 FROM t1 INTO @var17727401) UNION (SELECT 1 FROM t1 INTO t1); (SELECT 1 FROM t1 INTO @var17727401) UNION (SELECT 1 FROM t1 INTO t1);
ERROR HY000: Incorrect usage of UNION and INTO 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 'INTO @var17727401) UNION (SELECT 1 FROM t1 INTO t1)' at line 1
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 INTO @var17727401; SELECT 1 FROM t1 UNION SELECT 1 FROM t1 INTO @var17727401;
Warnings: Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warning 1329 No data - zero rows fetched, selected, or processed Warning 1329 No data - zero rows fetched, selected, or processed
SELECT 1 INTO @var17727401 FROM t1 PROCEDURE ANALYSE(); SELECT 1 INTO @var17727401 FROM t1 PROCEDURE ANALYSE();
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 'PROCEDURE ANALYSE()' at line 1 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 'PROCEDURE ANALYSE()' at line 1
SELECT 1 FROM t1 PROCEDURE ANALYSE() INTO @var17727401; SELECT 1 FROM t1 PROCEDURE ANALYSE() INTO @var17727401;
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 'INTO @var17727401' at line 1 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 'INTO @var17727401' at line 1
# ORDER and LIMIT clause combinations # ORDER and LIMIT clause combinations
(SELECT 1 FROM t1 ORDER BY 1) ORDER BY 1;
1
(SELECT 1 FROM t1 LIMIT 1) LIMIT 1;
1
((SELECT 1 FROM t1 ORDER BY 1) ORDER BY 1) ORDER BY 1;
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 'ORDER BY 1) ORDER BY 1' at line 1
((SELECT 1 FROM t1 LIMIT 1) LIMIT 1) LIMIT 1;
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 'LIMIT 1) LIMIT 1' at line 1
(SELECT 1 FROM t1 ORDER BY 1) LIMIT 1;
1
(SELECT 1 FROM t1 LIMIT 1) ORDER BY 1;
1
((SELECT 1 FROM t1 ORDER BY 1) LIMIT 1) ORDER BY 1); ((SELECT 1 FROM t1 ORDER BY 1) LIMIT 1) ORDER BY 1);
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 'LIMIT 1) ORDER BY 1)' at line 1 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 ')' at line 1
((SELECT 1 FROM t1 LIMIT 1) ORDER BY 1) LIMIT 1); ((SELECT 1 FROM t1 LIMIT 1) ORDER BY 1) LIMIT 1);
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 'ORDER BY 1) LIMIT 1)' at line 1 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 ')' at line 1
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1; SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1;
1 1
SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1); SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1);
@ -1265,19 +1261,27 @@ CREATE TABLE t1 (i INT);
(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)) (SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
UNION UNION
(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)); (SELECT * FROM t1 PROCEDURE ANALYSE(10, 10));
ERROR HY000: Incorrect usage of UNION and SELECT ... PROCEDURE ANALYSE() 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 'PROCEDURE ANALYSE(10, 10))
UNION
(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))' at line 1
(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)) (SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
UNION UNION
SELECT * FROM t1 PROCEDURE ANALYSE(10, 10); SELECT * FROM t1 PROCEDURE ANALYSE(10, 10);
ERROR HY000: Incorrect usage of UNION and SELECT ... PROCEDURE ANALYSE() 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 'PROCEDURE ANALYSE(10, 10))
UNION
SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)' at line 1
(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)) (SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
UNION UNION
(SELECT 1); (SELECT 1);
ERROR HY000: Incorrect usage of UNION and SELECT ... PROCEDURE ANALYSE() 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 'PROCEDURE ANALYSE(10, 10))
UNION
(SELECT 1)' at line 1
(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)) (SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
UNION UNION
SELECT 1; SELECT 1;
ERROR HY000: Incorrect usage of UNION and SELECT ... PROCEDURE ANALYSE() 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 'PROCEDURE ANALYSE(10, 10))
UNION
SELECT 1' at line 1
SELECT * FROM t1 PROCEDURE ANALYSE(10, 10) SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)
UNION UNION
(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)); (SELECT * FROM t1 PROCEDURE ANALYSE(10, 10));

View File

@ -825,6 +825,9 @@ SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
FOR UPDATE; FOR UPDATE;
--error ER_ORDER_WITH_PROC --error ER_ORDER_WITH_PROC
SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
PROCEDURE ANALYSE();
--error ER_ORDER_WITH_PROC
SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
PROCEDURE ANALYSE() FOR UPDATE; PROCEDURE ANALYSE() FOR UPDATE;
@ -851,7 +854,7 @@ UNION
SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
FOR UPDATE; FOR UPDATE;
--error ER_PARSE_ERROR --error ER_CANT_USE_OPTION_HERE
SELECT 1 FROM t1 SELECT 1 FROM t1
UNION UNION
SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
@ -876,7 +879,7 @@ UNION
--echo # "FOR UPDATE" tests --echo # "FOR UPDATE" tests
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1; SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
SELECT 1 FROM t1 FOR UPDATE UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1; (SELECT 1 FROM t1 FOR UPDATE) UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 FOR UPDATE; SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 FOR UPDATE;
@ -916,7 +919,7 @@ SELECT EXISTS(SELECT 1 FROM t1 INTO @var17727401);
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
SELECT 1 FROM t1 INTO @var17727401 UNION SELECT 1 FROM t1 INTO t1; SELECT 1 FROM t1 INTO @var17727401 UNION SELECT 1 FROM t1 INTO t1;
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
(SELECT 1 FROM t1 INTO @var17727401) UNION (SELECT 1 FROM t1 INTO t1); (SELECT 1 FROM t1 INTO @var17727401) UNION (SELECT 1 FROM t1 INTO t1);
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 INTO @var17727401; SELECT 1 FROM t1 UNION SELECT 1 FROM t1 INTO @var17727401;
@ -931,16 +934,16 @@ SELECT 1 FROM t1 PROCEDURE ANALYSE() INTO @var17727401;
# Limited support for (SELECT ...) ORDER/LIMIT: # Limited support for (SELECT ...) ORDER/LIMIT:
(SELECT 1 FROM t1 ORDER BY 1) ORDER BY 1; # (SELECT 1 FROM t1 ORDER BY 1) ORDER BY 1;
(SELECT 1 FROM t1 LIMIT 1) LIMIT 1; # (SELECT 1 FROM t1 LIMIT 1) LIMIT 1;
--error ER_PARSE_ERROR #--error ER_PARSE_ERROR
((SELECT 1 FROM t1 ORDER BY 1) ORDER BY 1) ORDER BY 1; # ((SELECT 1 FROM t1 ORDER BY 1) ORDER BY 1) ORDER BY 1;
--error ER_PARSE_ERROR #--error ER_PARSE_ERROR
((SELECT 1 FROM t1 LIMIT 1) LIMIT 1) LIMIT 1; # ((SELECT 1 FROM t1 LIMIT 1) LIMIT 1) LIMIT 1;
(SELECT 1 FROM t1 ORDER BY 1) LIMIT 1; # (SELECT 1 FROM t1 ORDER BY 1) LIMIT 1;
(SELECT 1 FROM t1 LIMIT 1) ORDER BY 1; # (SELECT 1 FROM t1 LIMIT 1) ORDER BY 1;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
((SELECT 1 FROM t1 ORDER BY 1) LIMIT 1) ORDER BY 1); ((SELECT 1 FROM t1 ORDER BY 1) LIMIT 1) ORDER BY 1);
@ -1276,22 +1279,22 @@ DROP TABLE t1;
--echo # --echo #
CREATE TABLE t1 (i INT); CREATE TABLE t1 (i INT);
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)) (SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
UNION UNION
(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)); (SELECT * FROM t1 PROCEDURE ANALYSE(10, 10));
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)) (SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
UNION UNION
SELECT * FROM t1 PROCEDURE ANALYSE(10, 10); SELECT * FROM t1 PROCEDURE ANALYSE(10, 10);
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)) (SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
UNION UNION
(SELECT 1); (SELECT 1);
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)) (SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
UNION UNION
SELECT 1; SELECT 1;

View File

@ -690,6 +690,8 @@ a b
-21 REPLACEd by REPLACE -21 REPLACEd by REPLACE
FLUSH STATUS; FLUSH STATUS;
SELECT * FROM t1 PARTITION (pNeg, `p10-99`) INTO OUTFILE 'loadtest.txt'; SELECT * FROM t1 PARTITION (pNeg, `p10-99`) INTO OUTFILE 'loadtest.txt';
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE

View File

@ -244,6 +244,8 @@ prepare stmt1 from "insert into t1 select i from t1";
execute stmt1; execute stmt1;
execute stmt1; execute stmt1;
prepare stmt1 from "select * from t1 into outfile '<MYSQLTEST_VARDIR>/tmp/f1.txt'"; prepare stmt1 from "select * from t1 into outfile '<MYSQLTEST_VARDIR>/tmp/f1.txt'";
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
execute stmt1; execute stmt1;
deallocate prepare stmt1; deallocate prepare stmt1;
drop table t1; drop table t1;

View File

@ -20,6 +20,8 @@ else
select '' as "SUCCESS"; select '' as "SUCCESS";
end if; end if;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
set @reprepare_count= 0; set @reprepare_count= 0;
flush status; flush status;
===================================================================== =====================================================================
@ -1071,6 +1073,8 @@ call p1(x);
return x; return x;
end| end|
create procedure p1(out x int) select max(a) from t1 into x; create procedure p1(out x int) select max(a) from t1 into x;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
prepare stmt from "select * from v1"; prepare stmt from "select * from v1";
execute stmt; execute stmt;
f1() f1()
@ -1083,6 +1087,8 @@ SUCCESS
drop procedure p1; drop procedure p1;
create procedure p1(out x int) select max(a) from t2 into x; create procedure p1(out x int) select max(a) from t2 into x;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# XXX: used to be a bug. The prelocked list was not invalidated # XXX: used to be a bug. The prelocked list was not invalidated
# and we kept opening table t1, whereas the procedure # and we kept opening table t1, whereas the procedure
# is now referring to table t2 # is now referring to table t2

View File

@ -20,6 +20,8 @@ else
select '' as "SUCCESS"; select '' as "SUCCESS";
end if; end if;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
set @reprepare_count= 0; set @reprepare_count= 0;
flush status; flush status;
drop table if exists t1; drop table if exists t1;

View File

@ -645,9 +645,13 @@ show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 0 Qcache_queries_in_cache 0
select * from t1 into outfile "query_cache.out.file"; select * from t1 into outfile "query_cache.out.file";
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
select * from t1 into outfile "query_cache.out.file"; select * from t1 into outfile "query_cache.out.file";
ERROR HY000: File 'query_cache.out.file' already exists ERROR HY000: File 'query_cache.out.file' already exists
select * from t1 limit 1 into dumpfile "query_cache.dump.file"; select * from t1 limit 1 into dumpfile "query_cache.dump.file";
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 0 Qcache_queries_in_cache 0
@ -1100,6 +1104,8 @@ Declare var1 int;
select max(a) from t1 into var1; select max(a) from t1 into var1;
return var1; return var1;
end// end//
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create procedure `p1`() create procedure `p1`()
begin begin
select a, f1() from t1; select a, f1() from t1;
@ -1858,17 +1864,17 @@ DROP TABLE t1;
SET GLOBAL query_cache_size= default; SET GLOBAL query_cache_size= default;
CREATE TABLE t1( a INT ); CREATE TABLE t1( a INT );
SET @v = ( SELECT SQL_CACHE 1 ); SET @v = ( SELECT SQL_CACHE 1 );
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 '1 )' at line 1 ERROR 42000: Incorrect usage/placement of 'SQL_CACHE'
SET @v = ( SELECT SQL_NO_CACHE 1 ); SET @v = ( SELECT SQL_NO_CACHE 1 );
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 '1 )' at line 1 ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
SELECT a FROM t1 WHERE a IN ( SELECT SQL_CACHE a FROM t1 ); SELECT a FROM t1 WHERE a IN ( SELECT SQL_CACHE a FROM t1 );
ERROR 42S22: Unknown column 'SQL_CACHE' in 'field list' ERROR 42000: Incorrect usage/placement of 'SQL_CACHE'
SELECT a FROM t1 WHERE a IN ( SELECT SQL_NO_CACHE a FROM t1 ); SELECT a FROM t1 WHERE a IN ( SELECT SQL_NO_CACHE a FROM t1 );
ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list' ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
SELECT ( SELECT SQL_CACHE a FROM t1 ); SELECT ( SELECT SQL_CACHE a FROM t1 );
ERROR 42S22: Unknown column 'SQL_CACHE' in 'field list' ERROR 42000: Incorrect usage/placement of 'SQL_CACHE'
SELECT ( SELECT SQL_NO_CACHE a FROM t1 ); SELECT ( SELECT SQL_NO_CACHE a FROM t1 );
ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list' ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
SELECT SQL_CACHE * FROM t1; SELECT SQL_CACHE * FROM t1;
a a
SELECT SQL_NO_CACHE * FROM t1; SELECT SQL_NO_CACHE * FROM t1;
@ -1878,18 +1884,18 @@ ERROR 42000: Incorrect usage/placement of 'SQL_CACHE'
SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1; SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE' ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
SELECT * FROM t1 WHERE a IN (SELECT SQL_CACHE a FROM t1); SELECT * FROM t1 WHERE a IN (SELECT SQL_CACHE a FROM t1);
ERROR 42S22: Unknown column 'SQL_CACHE' in 'field list' ERROR 42000: Incorrect usage/placement of 'SQL_CACHE'
SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 UNION SELECT SQL_CACHE a FROM t1); SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 UNION SELECT SQL_CACHE a FROM t1);
ERROR 42S22: Unknown column 'SQL_CACHE' in 'field list' ERROR 42000: Incorrect usage/placement of 'SQL_CACHE'
SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1; SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE' ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
SELECT * FROM t1 WHERE a IN (SELECT SQL_NO_CACHE a FROM t1); SELECT * FROM t1 WHERE a IN (SELECT SQL_NO_CACHE a FROM t1);
ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list' ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
SELECT * FROM t1 WHERE a IN SELECT * FROM t1 WHERE a IN
(SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1); (SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);
ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list' ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
SELECT SQL_CACHE SQL_NO_CACHE * FROM t1; SELECT SQL_CACHE SQL_NO_CACHE * FROM t1;
ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE ERROR HY000: Incorrect usage of SQL_NO_CACHE and SQL_CACHE
SELECT SQL_NO_CACHE SQL_CACHE * FROM t1; SELECT SQL_NO_CACHE SQL_CACHE * FROM t1;
ERROR HY000: Incorrect usage of SQL_NO_CACHE and SQL_CACHE ERROR HY000: Incorrect usage of SQL_NO_CACHE and SQL_CACHE
SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1; SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
@ -1902,10 +1908,10 @@ SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE' ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
SELECT SQL_CACHE * FROM t1 WHERE a IN SELECT SQL_CACHE * FROM t1 WHERE a IN
(SELECT SQL_NO_CACHE a FROM t1); (SELECT SQL_NO_CACHE a FROM t1);
ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list' ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
SELECT SQL_CACHE * FROM t1 WHERE a IN SELECT SQL_CACHE * FROM t1 WHERE a IN
(SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1); (SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);
ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list' ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
DROP TABLE t1; DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
# #

View File

@ -1534,22 +1534,21 @@ SET GLOBAL query_cache_size= default;
# #
CREATE TABLE t1( a INT ); CREATE TABLE t1( a INT );
--error ER_PARSE_ERROR --error ER_CANT_USE_OPTION_HERE
SET @v = ( SELECT SQL_CACHE 1 ); SET @v = ( SELECT SQL_CACHE 1 );
--error ER_PARSE_ERROR --error ER_CANT_USE_OPTION_HERE
SET @v = ( SELECT SQL_NO_CACHE 1 ); SET @v = ( SELECT SQL_NO_CACHE 1 );
# #
# Keywords 'SQL_CACHE' and 'SQL_NO_CACHE' are allowed as column names. # Keywords 'SQL_CACHE' and 'SQL_NO_CACHE'.
# Hence the error messages are not intuitive.
# #
--error ER_BAD_FIELD_ERROR --error ER_CANT_USE_OPTION_HERE
SELECT a FROM t1 WHERE a IN ( SELECT SQL_CACHE a FROM t1 ); SELECT a FROM t1 WHERE a IN ( SELECT SQL_CACHE a FROM t1 );
--error ER_BAD_FIELD_ERROR --error ER_CANT_USE_OPTION_HERE
SELECT a FROM t1 WHERE a IN ( SELECT SQL_NO_CACHE a FROM t1 ); SELECT a FROM t1 WHERE a IN ( SELECT SQL_NO_CACHE a FROM t1 );
--error ER_BAD_FIELD_ERROR --error ER_CANT_USE_OPTION_HERE
SELECT ( SELECT SQL_CACHE a FROM t1 ); SELECT ( SELECT SQL_CACHE a FROM t1 );
--error ER_BAD_FIELD_ERROR --error ER_CANT_USE_OPTION_HERE
SELECT ( SELECT SQL_NO_CACHE a FROM t1 ); SELECT ( SELECT SQL_NO_CACHE a FROM t1 );
SELECT SQL_CACHE * FROM t1; SELECT SQL_CACHE * FROM t1;
@ -1560,16 +1559,16 @@ SELECT SQL_NO_CACHE * FROM t1;
SELECT * FROM t1 UNION SELECT SQL_CACHE * FROM t1; SELECT * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
--error ER_CANT_USE_OPTION_HERE --error ER_CANT_USE_OPTION_HERE
SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1; SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
--error ER_BAD_FIELD_ERROR --error ER_CANT_USE_OPTION_HERE
SELECT * FROM t1 WHERE a IN (SELECT SQL_CACHE a FROM t1); SELECT * FROM t1 WHERE a IN (SELECT SQL_CACHE a FROM t1);
--error ER_BAD_FIELD_ERROR --error ER_CANT_USE_OPTION_HERE
SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 UNION SELECT SQL_CACHE a FROM t1); SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 UNION SELECT SQL_CACHE a FROM t1);
--error ER_CANT_USE_OPTION_HERE --error ER_CANT_USE_OPTION_HERE
SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1; SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
--error ER_BAD_FIELD_ERROR --error ER_CANT_USE_OPTION_HERE
SELECT * FROM t1 WHERE a IN (SELECT SQL_NO_CACHE a FROM t1); SELECT * FROM t1 WHERE a IN (SELECT SQL_NO_CACHE a FROM t1);
--error ER_BAD_FIELD_ERROR --error ER_CANT_USE_OPTION_HERE
SELECT * FROM t1 WHERE a IN SELECT * FROM t1 WHERE a IN
(SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1); (SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);
--error ER_WRONG_USAGE --error ER_WRONG_USAGE
@ -1584,10 +1583,10 @@ SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1; SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
--error ER_CANT_USE_OPTION_HERE --error ER_CANT_USE_OPTION_HERE
SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1; SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
--error ER_BAD_FIELD_ERROR --error ER_CANT_USE_OPTION_HERE
SELECT SQL_CACHE * FROM t1 WHERE a IN SELECT SQL_CACHE * FROM t1 WHERE a IN
(SELECT SQL_NO_CACHE a FROM t1); (SELECT SQL_NO_CACHE a FROM t1);
--error ER_BAD_FIELD_ERROR --error ER_CANT_USE_OPTION_HERE
SELECT SQL_CACHE * FROM t1 WHERE a IN SELECT SQL_CACHE * FROM t1 WHERE a IN
(SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1); (SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);

View File

@ -757,11 +757,11 @@ View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache current_timestamp() AS `NOW()` binary binary v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache current_timestamp() AS `NOW()` binary binary
DROP VIEW v1; DROP VIEW v1;
CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE NOW(); CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE NOW();
ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE ERROR HY000: Incorrect usage of SQL_NO_CACHE and SQL_CACHE
CREATE VIEW v1 AS SELECT SQL_NO_CACHE SQL_CACHE NOW(); CREATE VIEW v1 AS SELECT SQL_NO_CACHE SQL_CACHE NOW();
ERROR HY000: Incorrect usage of SQL_NO_CACHE and SQL_CACHE ERROR HY000: Incorrect usage of SQL_NO_CACHE and SQL_CACHE
CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE SQL_CACHE NOW(); CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE SQL_CACHE NOW();
ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE ERROR HY000: Option 'SQL_CACHE' used twice in statement
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
SET @s= 'CREATE VIEW v1 AS SELECT SQL_CACHE 1'; SET @s= 'CREATE VIEW v1 AS SELECT SQL_CACHE 1';

View File

@ -558,7 +558,7 @@ CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE NOW();
--error ER_WRONG_USAGE --error ER_WRONG_USAGE
CREATE VIEW v1 AS SELECT SQL_NO_CACHE SQL_CACHE NOW(); CREATE VIEW v1 AS SELECT SQL_NO_CACHE SQL_CACHE NOW();
--error ER_WRONG_USAGE --error ER_DUP_ARGUMENT
CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE SQL_CACHE NOW(); CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE SQL_CACHE NOW();
# Check CREATE VIEW in a prepared statement in a procedure. # Check CREATE VIEW in a prepared statement in a procedure.

View File

@ -2285,17 +2285,13 @@ begin
DECLARE foo CONDITION FOR SQLSTATE '12345'; DECLARE foo CONDITION FOR SQLSTATE '12345';
SIGNAL foo SET MYSQL_ERRNO = `65`; /* illegal */ SIGNAL foo SET MYSQL_ERRNO = `65`; /* illegal */
end $$ end $$
call test_signal $$
ERROR 42S22: Unknown column '65' in 'field list' ERROR 42S22: Unknown column '65' in 'field list'
drop procedure test_signal $$
create procedure test_signal() create procedure test_signal()
begin begin
DECLARE foo CONDITION FOR SQLSTATE '12345'; DECLARE foo CONDITION FOR SQLSTATE '12345';
SIGNAL foo SET MYSQL_ERRNO = `A`; /* illegal */ SIGNAL foo SET MYSQL_ERRNO = `A`; /* illegal */
end $$ end $$
call test_signal $$
ERROR 42S22: Unknown column 'A' in 'field list' ERROR 42S22: Unknown column 'A' in 'field list'
drop procedure test_signal $$
create procedure test_signal() create procedure test_signal()
begin begin
DECLARE foo CONDITION FOR SQLSTATE '12345'; DECLARE foo CONDITION FOR SQLSTATE '12345';
@ -2346,9 +2342,7 @@ DECLARE foo CONDITION FOR SQLSTATE '12345';
SIGNAL foo SET MYSQL_ERRNO = 1000, SIGNAL foo SET MYSQL_ERRNO = 1000,
MESSAGE_TEXT = `Hello`; MESSAGE_TEXT = `Hello`;
end $$ end $$
call test_signal $$
ERROR 42S22: Unknown column 'Hello' in 'field list' ERROR 42S22: Unknown column 'Hello' in 'field list'
drop procedure test_signal $$
create procedure test_signal() create procedure test_signal()
begin begin
DECLARE foo CONDITION FOR SQLSTATE '12345'; DECLARE foo CONDITION FOR SQLSTATE '12345';

View File

@ -2546,25 +2546,21 @@ end $$
call test_signal $$ call test_signal $$
drop procedure test_signal $$ drop procedure test_signal $$
-- error ER_BAD_FIELD_ERROR
create procedure test_signal() create procedure test_signal()
begin begin
DECLARE foo CONDITION FOR SQLSTATE '12345'; DECLARE foo CONDITION FOR SQLSTATE '12345';
SIGNAL foo SET MYSQL_ERRNO = `65`; /* illegal */ SIGNAL foo SET MYSQL_ERRNO = `65`; /* illegal */
end $$ end $$
-- error ER_BAD_FIELD_ERROR
call test_signal $$
drop procedure test_signal $$
-- error ER_BAD_FIELD_ERROR
create procedure test_signal() create procedure test_signal()
begin begin
DECLARE foo CONDITION FOR SQLSTATE '12345'; DECLARE foo CONDITION FOR SQLSTATE '12345';
SIGNAL foo SET MYSQL_ERRNO = `A`; /* illegal */ SIGNAL foo SET MYSQL_ERRNO = `A`; /* illegal */
end $$ end $$
-- error ER_BAD_FIELD_ERROR
call test_signal $$
drop procedure test_signal $$
create procedure test_signal() create procedure test_signal()
begin begin
@ -2620,6 +2616,7 @@ end $$
call test_signal $$ call test_signal $$
drop procedure test_signal $$ drop procedure test_signal $$
-- error ER_BAD_FIELD_ERROR
create procedure test_signal() create procedure test_signal()
begin begin
DECLARE foo CONDITION FOR SQLSTATE '12345'; DECLARE foo CONDITION FOR SQLSTATE '12345';
@ -2627,10 +2624,6 @@ begin
MESSAGE_TEXT = `Hello`; MESSAGE_TEXT = `Hello`;
end $$ end $$
-- error ER_BAD_FIELD_ERROR
call test_signal $$
drop procedure test_signal $$
create procedure test_signal() create procedure test_signal()
begin begin
DECLARE foo CONDITION FOR SQLSTATE '12345'; DECLARE foo CONDITION FOR SQLSTATE '12345';

View File

@ -75,6 +75,9 @@ end;
end case; end case;
end end
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create procedure check_pk_inventory(in id integer) create procedure check_pk_inventory(in id integer)
begin begin
declare x integer; declare x integer;
@ -92,6 +95,8 @@ MYSQL_ERRNO = 10000;
end if; end if;
end end
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create procedure check_pk_order(in id integer) create procedure check_pk_order(in id integer)
begin begin
declare x integer; declare x integer;
@ -108,6 +113,8 @@ MYSQL_ERRNO = 10000;
end if; end if;
end end
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create trigger po_order_bi before insert on po_order create trigger po_order_bi before insert on po_order
for each row for each row
begin begin

View File

@ -936,6 +936,8 @@ SELECT rec1.a, rec1.b;
END; END;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
ERROR 21000: The used SELECT statements have a different number of columns ERROR 21000: The used SELECT statements have a different number of columns
DROP TABLE t1; DROP TABLE t1;
@ -955,6 +957,8 @@ SELECT rec1.a, rec1.b;
END; END;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
ERROR 21000: Operand should contain 2 column(s) ERROR 21000: Operand should contain 2 column(s)
DROP TABLE t1; DROP TABLE t1;
@ -972,6 +976,8 @@ SELECT rec1.a, rec1.b;
END; END;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
rec1.a rec1.b rec1.a rec1.b
10 b10 10 b10

View File

@ -606,6 +606,8 @@ SELECT 10,'a','b' FROM t1 INTO rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
ERROR 21000: The used SELECT statements have a different number of columns ERROR 21000: The used SELECT statements have a different number of columns
DROP TABLE t1; DROP TABLE t1;
@ -622,6 +624,8 @@ SELECT 10,'a' FROM t1 INTO rec1, rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
ERROR 21000: Operand should contain 2 column(s) ERROR 21000: Operand should contain 2 column(s)
DROP TABLE t1; DROP TABLE t1;
@ -638,6 +642,8 @@ SELECT * FROM t1 INTO rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
rec1.a rec1.b rec1.a rec1.b
10 b10 10 b10

View File

@ -957,6 +957,8 @@ SELECT * FROM t1 INTO v_a, v_b, v_c;
SELECT v_a, v_b, v_c; SELECT v_a, v_b, v_c;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
v_a v_b v_c v_a v_b v_c
1 b1 2001-01-01 10:20:30.123 1 b1 2001-01-01 10:20:30.123

View File

@ -77,6 +77,8 @@ select count(*) as cnt from (select id1 from t1 force index (primary) where id1
set id1_cond = id1_cond + 1; set id1_cond = id1_cond + 1;
end while; end while;
end// end//
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
insert t1 select seq, seq, 1, 1, seq, seq, seq from seq_1_to_2000; insert t1 select seq, seq, 1, 1, seq, seq, seq from seq_1_to_2000;
set @before=unix_timestamp(); set @before=unix_timestamp();
call select_test(); call select_test();

View File

@ -1,5 +1,7 @@
drop table if exists t1, t2; drop table if exists t1, t2;
SELECT * FROM mysql.proc INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/proc.txt'; SELECT * FROM mysql.proc INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/proc.txt';
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
delete from mysql.proc; delete from mysql.proc;
create procedure syntaxerror(t int)| create procedure syntaxerror(t int)|
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 '' at line 1 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 '' at line 1
@ -12,6 +14,8 @@ create table t3 ( x int )|
insert into t3 values (2), (3)| insert into t3 values (2), (3)|
create procedure bad_into(out param int) create procedure bad_into(out param int)
select x from t3 into param| select x from t3 into param|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
call bad_into(@x)| call bad_into(@x)|
ERROR 42000: Result consisted of more than one row ERROR 42000: Result consisted of more than one row
drop procedure bad_into| drop procedure bad_into|
@ -439,6 +443,9 @@ create procedure nodb.bug3339() begin end|
ERROR 42000: Unknown database 'nodb' ERROR 42000: Unknown database 'nodb'
create procedure bug2653_1(a int, out b int) create procedure bug2653_1(a int, out b int)
set b = aa| set b = aa|
call bug2653_1(1, @b)|
ERROR 42S22: Unknown column 'aa' in 'field list'
drop procedure bug2653_1|
create procedure bug2653_2(a int, out b int) create procedure bug2653_2(a int, out b int)
begin begin
if aa < 0 then if aa < 0 then
@ -447,12 +454,7 @@ else
set b = a; set b = a;
end if; end if;
end| end|
call bug2653_1(1, @b)|
ERROR 42S22: Unknown column 'aa' in 'field list' ERROR 42S22: Unknown column 'aa' in 'field list'
call bug2653_2(2, @b)|
ERROR 42S22: Unknown column 'aa' in 'field list'
drop procedure bug2653_1|
drop procedure bug2653_2|
create procedure bug4344() drop procedure bug4344| create procedure bug4344() drop procedure bug4344|
ERROR HY000: Can't drop or alter a PROCEDURE from within another stored routine ERROR HY000: Can't drop or alter a PROCEDURE from within another stored routine
create procedure bug4344() drop function bug4344| create procedure bug4344() drop function bug4344|
@ -1067,6 +1069,7 @@ IF bug13037_foo THEN
SELECT 1; SELECT 1;
END IF; END IF;
END| END|
ERROR 42S22: Unknown column 'bug13037_foo' in 'field list'
CREATE PROCEDURE bug13037_p2() CREATE PROCEDURE bug13037_p2()
BEGIN BEGIN
SET @bug13037_foo = bug13037_bar; SET @bug13037_foo = bug13037_bar;
@ -1076,19 +1079,14 @@ BEGIN
SELECT bug13037_foo; SELECT bug13037_foo;
END| END|
CALL bug13037_p1(); CALL bug13037_p2();
ERROR 42S22: Unknown column 'bug13037_bar' in 'field list'
CALL bug13037_p3();
ERROR 42S22: Unknown column 'bug13037_foo' in 'field list' ERROR 42S22: Unknown column 'bug13037_foo' in 'field list'
CALL bug13037_p2(); CALL bug13037_p2();
ERROR 42S22: Unknown column 'bug13037_bar' in 'field list' ERROR 42S22: Unknown column 'bug13037_bar' in 'field list'
CALL bug13037_p3(); CALL bug13037_p3();
ERROR 42S22: Unknown column 'bug13037_foo' in 'field list' ERROR 42S22: Unknown column 'bug13037_foo' in 'field list'
CALL bug13037_p1();
ERROR 42S22: Unknown column 'bug13037_foo' in 'field list'
CALL bug13037_p2();
ERROR 42S22: Unknown column 'bug13037_bar' in 'field list'
CALL bug13037_p3();
ERROR 42S22: Unknown column 'bug13037_foo' in 'field list'
DROP PROCEDURE bug13037_p1;
DROP PROCEDURE bug13037_p2; DROP PROCEDURE bug13037_p2;
DROP PROCEDURE bug13037_p3; DROP PROCEDURE bug13037_p3;
create database mysqltest1; create database mysqltest1;
@ -2848,6 +2846,8 @@ DECLARE v VARCHAR(5) DEFAULT -1;
SELECT b FROM t1 WHERE a = 2 INTO v; SELECT b FROM t1 WHERE a = 2 INTO v;
RETURN v; RETURN v;
END| END|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Here we check that the NOT_FOUND condition raised in f1() # Here we check that the NOT_FOUND condition raised in f1()
# is not visible in the outer function (f2), i.e. the continue # is not visible in the outer function (f2), i.e. the continue

View File

@ -608,6 +608,12 @@ create procedure nodb.bug3339() begin end|
create procedure bug2653_1(a int, out b int) create procedure bug2653_1(a int, out b int)
set b = aa| set b = aa|
--error ER_BAD_FIELD_ERROR
call bug2653_1(1, @b)|
drop procedure bug2653_1|
--error ER_BAD_FIELD_ERROR
create procedure bug2653_2(a int, out b int) create procedure bug2653_2(a int, out b int)
begin begin
if aa < 0 then if aa < 0 then
@ -617,13 +623,6 @@ begin
end if; end if;
end| end|
--error 1054
call bug2653_1(1, @b)|
--error 1054
call bug2653_2(2, @b)|
drop procedure bug2653_1|
drop procedure bug2653_2|
# #
# BUG#4344 # BUG#4344
@ -1507,6 +1506,7 @@ DROP PROCEDURE IF EXISTS bug13037_p3;
delimiter |; delimiter |;
--error ER_BAD_FIELD_ERROR
CREATE PROCEDURE bug13037_p1() CREATE PROCEDURE bug13037_p1()
BEGIN BEGIN
IF bug13037_foo THEN IF bug13037_foo THEN
@ -1528,21 +1528,16 @@ delimiter ;|
--echo --echo
--error 1054
CALL bug13037_p1();
--error 1054 --error 1054
CALL bug13037_p2(); CALL bug13037_p2();
--error 1054 --error 1054
CALL bug13037_p3(); CALL bug13037_p3();
--error 1054
CALL bug13037_p1();
--error 1054 --error 1054
CALL bug13037_p2(); CALL bug13037_p2();
--error 1054 --error 1054
CALL bug13037_p3(); CALL bug13037_p3();
DROP PROCEDURE bug13037_p1;
DROP PROCEDURE bug13037_p2; DROP PROCEDURE bug13037_p2;
DROP PROCEDURE bug13037_p3; DROP PROCEDURE bug13037_p3;

View File

@ -2135,6 +2135,8 @@ SELECT * FROM t1 INTO rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
ERROR 21000: The used SELECT statements have a different number of columns ERROR 21000: The used SELECT statements have a different number of columns
DROP TABLE t1; DROP TABLE t1;
@ -2149,6 +2151,8 @@ SELECT * FROM t1 INTO rec1, rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
ERROR 21000: Operand should contain 2 column(s) ERROR 21000: Operand should contain 2 column(s)
DROP TABLE t1; DROP TABLE t1;
@ -2163,6 +2167,8 @@ SELECT * FROM t1 INTO rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
rec1.a rec1.b rec1.a rec1.b
10 b10 10 b10

View File

@ -314,10 +314,12 @@ delete from t1|
drop procedure b| drop procedure b|
drop procedure if exists b2| drop procedure if exists b2|
create procedure b2(x int) create procedure b2(x int)
repeat(select 1 into outfile 'b2'); repeat(select 1) into outfile 'b2';
insert into test.t1 values (repeat("b2",3), x); insert into test.t1 values (repeat("b2",3), x);
set x = x-1; set x = x-1;
until x = 0 end repeat| until x = 0 end repeat|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
drop procedure b2| drop procedure b2|
drop procedure if exists c| drop procedure if exists c|
create procedure c(x int) create procedure c(x int)
@ -4179,6 +4181,7 @@ select v, isnull(v);
end if; end if;
end; end;
end| end|
ERROR 42S22: Unknown column 'undefined_var' in 'field list'
create procedure bug14643_2() create procedure bug14643_2()
begin begin
declare continue handler for sqlexception select 'boo' as 'Handler'; declare continue handler for sqlexception select 'boo' as 'Handler';
@ -4190,18 +4193,7 @@ select 2;
end case; end case;
select undefined_var; select undefined_var;
end| end|
call bug14643_1()| ERROR 42S22: Unknown column 'undefined_var' in 'field list'
Handler
boo
v isnull(v)
NULL 1
call bug14643_2()|
Handler
boo
Handler
boo
drop procedure bug14643_1|
drop procedure bug14643_2|
drop procedure if exists bug14304| drop procedure if exists bug14304|
drop table if exists t3, t4| drop table if exists t3, t4|
create table t3(a int primary key auto_increment)| create table t3(a int primary key auto_increment)|
@ -4231,9 +4223,7 @@ create procedure bug14376()
begin begin
declare x int default x; declare x int default x;
end| end|
call bug14376()|
ERROR 42S22: Unknown column 'x' in 'field list' ERROR 42S22: Unknown column 'x' in 'field list'
drop procedure bug14376|
create procedure bug14376() create procedure bug14376()
begin begin
declare x int default 42; declare x int default 42;
@ -4290,6 +4280,9 @@ select i as 'A local variable in a nested compound statement takes precedence o
end; end;
end; end;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
call bug5967("a - stored procedure parameter")| call bug5967("a - stored procedure parameter")|
a a
a - stored procedure parameter a - stored procedure parameter
@ -4476,6 +4469,7 @@ select 'no' as 'v';
end if; end if;
select 'done' as 'End'; select 'done' as 'End';
end| end|
ERROR 42S22: Unknown column 'v' in 'field list'
create procedure bug14498_2() create procedure bug14498_2()
begin begin
declare continue handler for sqlexception select 'error' as 'Handler'; declare continue handler for sqlexception select 'error' as 'Handler';
@ -4484,6 +4478,7 @@ select 'yes' as 'v';
end while; end while;
select 'done' as 'End'; select 'done' as 'End';
end| end|
ERROR 42S22: Unknown column 'v' in 'field list'
create procedure bug14498_3() create procedure bug14498_3()
begin begin
declare continue handler for sqlexception select 'error' as 'Handler'; declare continue handler for sqlexception select 'error' as 'Handler';
@ -4492,6 +4487,7 @@ select 'maybe' as 'v';
until v end repeat; until v end repeat;
select 'done' as 'End'; select 'done' as 'End';
end| end|
ERROR 42S22: Unknown column 'v' in 'field list'
create procedure bug14498_4() create procedure bug14498_4()
begin begin
declare continue handler for sqlexception select 'error' as 'Handler'; declare continue handler for sqlexception select 'error' as 'Handler';
@ -4505,6 +4501,7 @@ select '?' as 'v';
end case; end case;
select 'done' as 'End'; select 'done' as 'End';
end| end|
ERROR 42S22: Unknown column 'v' in 'field list'
create procedure bug14498_5() create procedure bug14498_5()
begin begin
declare continue handler for sqlexception select 'error' as 'Handler'; declare continue handler for sqlexception select 'error' as 'Handler';
@ -4518,38 +4515,7 @@ select '?' as 'v';
end case; end case;
select 'done' as 'End'; select 'done' as 'End';
end| end|
call bug14498_1()| ERROR 42S22: Unknown column 'v' in 'field list'
Handler
error
End
done
call bug14498_2()|
Handler
error
End
done
call bug14498_3()|
v
maybe
Handler
error
End
done
call bug14498_4()|
Handler
error
End
done
call bug14498_5()|
Handler
error
End
done
drop procedure bug14498_1|
drop procedure bug14498_2|
drop procedure bug14498_3|
drop procedure bug14498_4|
drop procedure bug14498_5|
drop table if exists t3| drop table if exists t3|
drop procedure if exists bug15231_1| drop procedure if exists bug15231_1|
drop procedure if exists bug15231_2| drop procedure if exists bug15231_2|
@ -5797,6 +5763,8 @@ end;
select 1 from no_such_view limit 1 into x; select 1 from no_such_view limit 1 into x;
return x; return x;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create function func_8407_b() returns int create function func_8407_b() returns int
begin begin
declare x int default 0; declare x int default 0;
@ -8339,14 +8307,12 @@ DECLARE name VARCHAR(10);
SET name="hello"; SET name="hello";
call p1(name2); call p1(name2);
END| END|
ERROR 42S22: Unknown column 'name2' in 'field list'
call p2(); call p2();
a a
hello hello
call p3();
ERROR 42S22: Unknown column 'name2' in 'field list'
drop procedure p1; drop procedure p1;
drop procedure p2; drop procedure p2;
drop procedure p3;
# #
# MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM # MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM
# LAST_INSERT_ID () # LAST_INSERT_ID ()

View File

@ -440,7 +440,7 @@ drop procedure b|
drop procedure if exists b2| drop procedure if exists b2|
--enable_warnings --enable_warnings
create procedure b2(x int) create procedure b2(x int)
repeat(select 1 into outfile 'b2'); repeat(select 1) into outfile 'b2';
insert into test.t1 values (repeat("b2",3), x); insert into test.t1 values (repeat("b2",3), x);
set x = x-1; set x = x-1;
until x = 0 end repeat| until x = 0 end repeat|
@ -5040,6 +5040,7 @@ drop procedure if exists bug14643_1|
drop procedure if exists bug14643_2| drop procedure if exists bug14643_2|
--enable_warnings --enable_warnings
--error ER_BAD_FIELD_ERROR
create procedure bug14643_1() create procedure bug14643_1()
begin begin
declare continue handler for sqlexception select 'boo' as 'Handler'; declare continue handler for sqlexception select 'boo' as 'Handler';
@ -5055,6 +5056,7 @@ begin
end; end;
end| end|
--error ER_BAD_FIELD_ERROR
create procedure bug14643_2() create procedure bug14643_2()
begin begin
declare continue handler for sqlexception select 'boo' as 'Handler'; declare continue handler for sqlexception select 'boo' as 'Handler';
@ -5069,11 +5071,6 @@ begin
select undefined_var; select undefined_var;
end| end|
call bug14643_1()|
call bug14643_2()|
drop procedure bug14643_1|
drop procedure bug14643_2|
# #
# BUG#14304: auto_increment field incorrect set in SP # BUG#14304: auto_increment field incorrect set in SP
@ -5114,15 +5111,12 @@ drop table t3, t4|
drop procedure if exists bug14376| drop procedure if exists bug14376|
--enable_warnings --enable_warnings
--error ER_BAD_FIELD_ERROR
create procedure bug14376() create procedure bug14376()
begin begin
declare x int default x; declare x int default x;
end| end|
# Not the error we want, but that's what we got for now...
--error ER_BAD_FIELD_ERROR
call bug14376()|
drop procedure bug14376|
create procedure bug14376() create procedure bug14376()
begin begin
@ -5344,6 +5338,7 @@ drop procedure if exists bug14498_4|
drop procedure if exists bug14498_5| drop procedure if exists bug14498_5|
--enable_warnings --enable_warnings
--error ER_BAD_FIELD_ERROR
create procedure bug14498_1() create procedure bug14498_1()
begin begin
declare continue handler for sqlexception select 'error' as 'Handler'; declare continue handler for sqlexception select 'error' as 'Handler';
@ -5356,6 +5351,7 @@ begin
select 'done' as 'End'; select 'done' as 'End';
end| end|
--error ER_BAD_FIELD_ERROR
create procedure bug14498_2() create procedure bug14498_2()
begin begin
declare continue handler for sqlexception select 'error' as 'Handler'; declare continue handler for sqlexception select 'error' as 'Handler';
@ -5366,6 +5362,7 @@ begin
select 'done' as 'End'; select 'done' as 'End';
end| end|
--error ER_BAD_FIELD_ERROR
create procedure bug14498_3() create procedure bug14498_3()
begin begin
declare continue handler for sqlexception select 'error' as 'Handler'; declare continue handler for sqlexception select 'error' as 'Handler';
@ -5376,6 +5373,7 @@ begin
select 'done' as 'End'; select 'done' as 'End';
end| end|
--error ER_BAD_FIELD_ERROR
create procedure bug14498_4() create procedure bug14498_4()
begin begin
declare continue handler for sqlexception select 'error' as 'Handler'; declare continue handler for sqlexception select 'error' as 'Handler';
@ -5391,6 +5389,7 @@ begin
select 'done' as 'End'; select 'done' as 'End';
end| end|
--error ER_BAD_FIELD_ERROR
create procedure bug14498_5() create procedure bug14498_5()
begin begin
declare continue handler for sqlexception select 'error' as 'Handler'; declare continue handler for sqlexception select 'error' as 'Handler';
@ -5406,17 +5405,6 @@ begin
select 'done' as 'End'; select 'done' as 'End';
end| end|
call bug14498_1()|
call bug14498_2()|
call bug14498_3()|
call bug14498_4()|
call bug14498_5()|
drop procedure bug14498_1|
drop procedure bug14498_2|
drop procedure bug14498_3|
drop procedure bug14498_4|
drop procedure bug14498_5|
# #
# BUG#15231: Stored procedure bug with not found condition handler # BUG#15231: Stored procedure bug with not found condition handler
@ -9842,6 +9830,8 @@ BEGIN
SET name="hello"; SET name="hello";
call p1(name); call p1(name);
END| END|
--error ER_BAD_FIELD_ERROR
CREATE OR REPLACE PROCEDURE p3 () CREATE OR REPLACE PROCEDURE p3 ()
BEGIN BEGIN
DECLARE name VARCHAR(10); DECLARE name VARCHAR(10);
@ -9852,11 +9842,8 @@ END|
DELIMITER ;| DELIMITER ;|
call p2(); call p2();
--error ER_BAD_FIELD_ERROR
call p3();
drop procedure p1; drop procedure p1;
drop procedure p2; drop procedure p2;
drop procedure p3;
--echo # --echo #
--echo # MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM --echo # MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM

View File

@ -506,6 +506,8 @@ insert into t3 select a from t3;
select count(*)*255 from t3 into table_size; select count(*)*255 from t3 into table_size;
until table_size > max_table_size*2 end repeat; until table_size > max_table_size*2 end repeat;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
call bug14210_fill_table()| call bug14210_fill_table()|
drop procedure bug14210_fill_table| drop procedure bug14210_fill_table|
create table t4 like t3| create table t4 like t3|

View File

@ -11,6 +11,8 @@ insert into t1 values (null);
select count(*) from t1 into @a; select count(*) from t1 into @a;
return @a; return @a;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
reset master; reset master;
insert into t2 values (bug23333(),1); insert into t2 values (bug23333(),1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ERROR 23000: Duplicate entry '1' for key 'PRIMARY'

View File

@ -179,7 +179,8 @@ select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
a b a b
1 7 1 7
2 7 2 7
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3; (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
union (select * from t4 order by a limit 2) order by a limit 3;
a b a b
1 7 1 7
2 7 2 7
@ -3726,7 +3727,7 @@ SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
i i
SELECT * FROM t1 SELECT * FROM t1
WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
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 'UNION (SELECT i FROM t1)))' at line 2 i
explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12)) explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
from t1; from t1;
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 'union (select t12.i from t1 t12)) 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 'union (select t12.i from t1 t12))
@ -5186,35 +5187,23 @@ a 1
1 1 1 1
2 1 2 1
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1; SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
ERROR 42000: Every derived table must have its own alias 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 'ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1; SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
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 'SELECT 1) ON 1' at line 1 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 'UNION SELECT 1) ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1; SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
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 'SELECT 1)) ON 1' at line 1 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 'UNION SELECT 1)) ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1; SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
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 't1a ON 1' at line 1 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 ') t1a ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
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 't1a ON 1' at line 1 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 ')) t1a ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) ON 1; SELECT * FROM t1 JOIN (t1 t1a) ON 1;
a 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 ') ON 1' at line 1
1 1
2 1
1 2
2 2
SELECT * FROM t1 JOIN ((t1 t1a)) ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) ON 1;
a 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 ')) ON 1' at line 1
1 1
2 1
1 2
2 2
SELECT * FROM (t1 t1a); SELECT * FROM (t1 t1a);
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 ')' at line 1
1
2
SELECT * FROM ((t1 t1a)); SELECT * FROM ((t1 t1a));
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 '))' at line 1
1
2
SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1; SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1;
a t1a a t1a
1 1 1 1
@ -5289,11 +5278,14 @@ SELECT ( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ), a FROM t1;
SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2); SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2);
a b a b
SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ); SELECT 1 UNION ( SELECT 1 UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 1
1
( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
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 'UNION SELECT 1 ) UNION SELECT 1' at line 1 1
1
SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) )
1
SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
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 'UNION SELECT 1' at line 1 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 'UNION SELECT 1' at line 1
SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ); SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
@ -5303,9 +5295,9 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
((SELECT 1 UNION SELECT 1 UNION SELECT 1)) ((SELECT 1 UNION SELECT 1 UNION SELECT 1))
1 1
SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 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 '' at line 1
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
ERROR 42000: Every derived table must have its own alias 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 '' at line 1
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a; SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a;
1 1
1 1
@ -5313,19 +5305,25 @@ SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
1 1
1 1
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 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 'UNION SELECT 1 )' at line 1
SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1 a
1
SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1 a
1
SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 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 'UNION SELECT 1 )' at line 1
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );

View File

@ -99,7 +99,8 @@ select (select a from t3), a from t2;
select * from t2 where t2.a=(select a from t1); select * from t2 where t2.a=(select a from t1);
insert into t3 values (6),(7),(3); insert into t3 values (6),(7),(3);
select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1); select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3; (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
union (select * from t4 order by a limit 2) order by a limit 3;
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2; select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
@ -2604,8 +2605,6 @@ SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
(SELECT i FROM t1) (SELECT i FROM t1)
); );
#TODO:not supported
--error ER_PARSE_ERROR
SELECT * FROM t1 SELECT * FROM t1
WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
@ -4313,7 +4312,7 @@ SELECT * FROM (SELECT 1 a UNION SELECT 1 a ORDER BY a LIMIT 1) t1a;
# aliases after. # aliases after.
# #
SELECT * FROM t1 JOIN (SELECT 1 UNION SELECT 1) alias ON 1; SELECT * FROM t1 JOIN (SELECT 1 UNION SELECT 1) alias ON 1;
--error ER_DERIVED_MUST_HAVE_ALIAS --error ER_PARSE_ERROR
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1; SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1; SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
@ -4324,10 +4323,14 @@ SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
--error ER_PARSE_ERROR
SELECT * FROM t1 JOIN (t1 t1a) ON 1; SELECT * FROM t1 JOIN (t1 t1a) ON 1;
--error ER_PARSE_ERROR
SELECT * FROM t1 JOIN ((t1 t1a)) ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) ON 1;
--error ER_PARSE_ERROR
SELECT * FROM (t1 t1a); SELECT * FROM (t1 t1a);
--error ER_PARSE_ERROR
SELECT * FROM ((t1 t1a)); SELECT * FROM ((t1 t1a));
SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1; SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1;
@ -4391,12 +4394,9 @@ SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2);
# Make sure the parser does not allow nested UNIONs anywhere # Make sure the parser does not allow nested UNIONs anywhere
--error ER_PARSE_ERROR
SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ); SELECT 1 UNION ( SELECT 1 UNION SELECT 1 );
--error ER_PARSE_ERROR
( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
--error ER_PARSE_ERROR
SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
@ -4405,25 +4405,19 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
--error ER_DERIVED_MUST_HAVE_ALIAS --error ER_PARSE_ERROR
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a; SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a;
SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a; SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
--error ER_PARSE_ERROR
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
--error ER_PARSE_ERROR
SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
--error ER_PARSE_ERROR
SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
--error ER_PARSE_ERROR
SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
--error ER_PARSE_ERROR
SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
--error ER_PARSE_ERROR
SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );

View File

@ -37,6 +37,8 @@ create index Language on CountryLanguage(Language);
create index CityName on City(Name); create index CityName on City(Name);
alter table City change population population int(11) null default 0; alter table City change population population int(11) null default 0;
select max(id) from City into @max_city_id; select max(id) from City into @max_city_id;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL); insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL);
SELECT COUNT(*) FROM Country; SELECT COUNT(*) FROM Country;
COUNT(*) COUNT(*)

View File

@ -2179,11 +2179,11 @@ drop database mysqltest4;
# (both 1st and further executions) # (both 1st and further executions)
CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM; CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
INSERT INTO t1 VALUES (0),(8); INSERT INTO t1 VALUES (0),(8);
SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2)); SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM t1 AS t2);
a a
0 0
PREPARE stmt FROM " PREPARE stmt FROM "
SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2)) SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM t1 AS t2)
"; ";
execute stmt; execute stmt;
a a

View File

@ -40,6 +40,8 @@ create index Language on CountryLanguage(Language);
create index CityName on City(Name); create index CityName on City(Name);
alter table City change population population int(11) null default 0; alter table City change population population int(11) null default 0;
select max(id) from City into @max_city_id; select max(id) from City into @max_city_id;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL); insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL);
SELECT COUNT(*) FROM Country; SELECT COUNT(*) FROM Country;
COUNT(*) COUNT(*)

View File

@ -183,7 +183,8 @@ select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
a b a b
1 7 1 7
2 7 2 7
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3; (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
union (select * from t4 order by a limit 2) order by a limit 3;
a b a b
1 7 1 7
2 7 2 7
@ -3729,7 +3730,7 @@ SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
i i
SELECT * FROM t1 SELECT * FROM t1
WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
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 'UNION (SELECT i FROM t1)))' at line 2 i
explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12)) explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
from t1; from t1;
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 'union (select t12.i from t1 t12)) 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 'union (select t12.i from t1 t12))
@ -5188,35 +5189,23 @@ a 1
1 1 1 1
2 1 2 1
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1; SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
ERROR 42000: Every derived table must have its own alias 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 'ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1; SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
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 'SELECT 1) ON 1' at line 1 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 'UNION SELECT 1) ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1; SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
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 'SELECT 1)) ON 1' at line 1 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 'UNION SELECT 1)) ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1; SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
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 't1a ON 1' at line 1 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 ') t1a ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
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 't1a ON 1' at line 1 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 ')) t1a ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) ON 1; SELECT * FROM t1 JOIN (t1 t1a) ON 1;
a 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 ') ON 1' at line 1
1 1
2 1
1 2
2 2
SELECT * FROM t1 JOIN ((t1 t1a)) ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) ON 1;
a 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 ')) ON 1' at line 1
1 1
2 1
1 2
2 2
SELECT * FROM (t1 t1a); SELECT * FROM (t1 t1a);
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 ')' at line 1
1
2
SELECT * FROM ((t1 t1a)); SELECT * FROM ((t1 t1a));
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 '))' at line 1
1
2
SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1; SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1;
a t1a a t1a
1 1 1 1
@ -5291,11 +5280,14 @@ SELECT ( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ), a FROM t1;
SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2); SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2);
a b a b
SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ); SELECT 1 UNION ( SELECT 1 UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 1
1
( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
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 'UNION SELECT 1 ) UNION SELECT 1' at line 1 1
1
SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) )
1
SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
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 'UNION SELECT 1' at line 1 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 'UNION SELECT 1' at line 1
SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ); SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
@ -5305,9 +5297,9 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
((SELECT 1 UNION SELECT 1 UNION SELECT 1)) ((SELECT 1 UNION SELECT 1 UNION SELECT 1))
1 1
SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 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 '' at line 1
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
ERROR 42000: Every derived table must have its own alias 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 '' at line 1
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a; SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a;
1 1
1 1
@ -5315,19 +5307,25 @@ SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
1 1
1 1
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 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 'UNION SELECT 1 )' at line 1
SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1 a
1
SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1 a
1
SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 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 'UNION SELECT 1 )' at line 1
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );

View File

@ -186,7 +186,8 @@ select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
a b a b
1 7 1 7
2 7 2 7
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3; (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
union (select * from t4 order by a limit 2) order by a limit 3;
a b a b
1 7 1 7
2 7 2 7
@ -3729,7 +3730,7 @@ SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
i i
SELECT * FROM t1 SELECT * FROM t1
WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
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 'UNION (SELECT i FROM t1)))' at line 2 i
explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12)) explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
from t1; from t1;
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 'union (select t12.i from t1 t12)) 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 'union (select t12.i from t1 t12))
@ -5186,35 +5187,23 @@ a 1
1 1 1 1
2 1 2 1
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1; SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
ERROR 42000: Every derived table must have its own alias 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 'ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1; SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
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 'SELECT 1) ON 1' at line 1 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 'UNION SELECT 1) ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1; SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
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 'SELECT 1)) ON 1' at line 1 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 'UNION SELECT 1)) ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1; SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
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 't1a ON 1' at line 1 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 ') t1a ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
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 't1a ON 1' at line 1 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 ')) t1a ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) ON 1; SELECT * FROM t1 JOIN (t1 t1a) ON 1;
a 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 ') ON 1' at line 1
1 1
2 1
1 2
2 2
SELECT * FROM t1 JOIN ((t1 t1a)) ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) ON 1;
a 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 ')) ON 1' at line 1
1 1
2 1
1 2
2 2
SELECT * FROM (t1 t1a); SELECT * FROM (t1 t1a);
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 ')' at line 1
1
2
SELECT * FROM ((t1 t1a)); SELECT * FROM ((t1 t1a));
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 '))' at line 1
1
2
SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1; SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1;
a t1a a t1a
1 1 1 1
@ -5289,11 +5278,14 @@ SELECT ( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ), a FROM t1;
SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2); SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2);
a b a b
SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ); SELECT 1 UNION ( SELECT 1 UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 1
1
( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
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 'UNION SELECT 1 ) UNION SELECT 1' at line 1 1
1
SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) )
1
SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
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 'UNION SELECT 1' at line 1 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 'UNION SELECT 1' at line 1
SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ); SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
@ -5303,9 +5295,9 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
((SELECT 1 UNION SELECT 1 UNION SELECT 1)) ((SELECT 1 UNION SELECT 1 UNION SELECT 1))
1 1
SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 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 '' at line 1
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
ERROR 42000: Every derived table must have its own alias 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 '' at line 1
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a; SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a;
1 1
1 1
@ -5313,19 +5305,25 @@ SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
1 1
1 1
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 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 'UNION SELECT 1 )' at line 1
SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1 a
1
SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1 a
1
SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 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 'UNION SELECT 1 )' at line 1
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );

View File

@ -182,7 +182,8 @@ select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
a b a b
1 7 1 7
2 7 2 7
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3; (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
union (select * from t4 order by a limit 2) order by a limit 3;
a b a b
1 7 1 7
2 7 2 7
@ -3725,7 +3726,7 @@ SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
i i
SELECT * FROM t1 SELECT * FROM t1
WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
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 'UNION (SELECT i FROM t1)))' at line 2 i
explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12)) explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
from t1; from t1;
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 'union (select t12.i from t1 t12)) 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 'union (select t12.i from t1 t12))
@ -5182,35 +5183,23 @@ a 1
1 1 1 1
2 1 2 1
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1; SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
ERROR 42000: Every derived table must have its own alias 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 'ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1; SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
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 'SELECT 1) ON 1' at line 1 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 'UNION SELECT 1) ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1; SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
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 'SELECT 1)) ON 1' at line 1 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 'UNION SELECT 1)) ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1; SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
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 't1a ON 1' at line 1 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 ') t1a ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
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 't1a ON 1' at line 1 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 ')) t1a ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) ON 1; SELECT * FROM t1 JOIN (t1 t1a) ON 1;
a 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 ') ON 1' at line 1
1 1
2 1
1 2
2 2
SELECT * FROM t1 JOIN ((t1 t1a)) ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) ON 1;
a 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 ')) ON 1' at line 1
1 1
2 1
1 2
2 2
SELECT * FROM (t1 t1a); SELECT * FROM (t1 t1a);
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 ')' at line 1
1
2
SELECT * FROM ((t1 t1a)); SELECT * FROM ((t1 t1a));
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 '))' at line 1
1
2
SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1; SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1;
a t1a a t1a
1 1 1 1
@ -5285,11 +5274,14 @@ SELECT ( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ), a FROM t1;
SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2); SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2);
a b a b
SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ); SELECT 1 UNION ( SELECT 1 UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 1
1
( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
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 'UNION SELECT 1 ) UNION SELECT 1' at line 1 1
1
SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) )
1
SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
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 'UNION SELECT 1' at line 1 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 'UNION SELECT 1' at line 1
SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ); SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
@ -5299,9 +5291,9 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
((SELECT 1 UNION SELECT 1 UNION SELECT 1)) ((SELECT 1 UNION SELECT 1 UNION SELECT 1))
1 1
SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 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 '' at line 1
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
ERROR 42000: Every derived table must have its own alias 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 '' at line 1
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a; SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a;
1 1
1 1
@ -5309,19 +5301,25 @@ SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
1 1
1 1
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 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 'UNION SELECT 1 )' at line 1
SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1 a
1
SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1 a
1
SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 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 'UNION SELECT 1 )' at line 1
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );

View File

@ -185,7 +185,8 @@ select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
a b a b
1 7 1 7
2 7 2 7
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3; (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
union (select * from t4 order by a limit 2) order by a limit 3;
a b a b
1 7 1 7
2 7 2 7
@ -3732,7 +3733,7 @@ SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
i i
SELECT * FROM t1 SELECT * FROM t1
WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
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 'UNION (SELECT i FROM t1)))' at line 2 i
explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12)) explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
from t1; from t1;
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 'union (select t12.i from t1 t12)) 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 'union (select t12.i from t1 t12))
@ -5192,35 +5193,23 @@ a 1
1 1 1 1
2 1 2 1
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1; SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
ERROR 42000: Every derived table must have its own alias 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 'ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1; SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
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 'SELECT 1) ON 1' at line 1 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 'UNION SELECT 1) ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1; SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
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 'SELECT 1)) ON 1' at line 1 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 'UNION SELECT 1)) ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1; SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
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 't1a ON 1' at line 1 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 ') t1a ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
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 't1a ON 1' at line 1 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 ')) t1a ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) ON 1; SELECT * FROM t1 JOIN (t1 t1a) ON 1;
a 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 ') ON 1' at line 1
1 1
2 1
1 2
2 2
SELECT * FROM t1 JOIN ((t1 t1a)) ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) ON 1;
a 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 ')) ON 1' at line 1
1 1
2 1
1 2
2 2
SELECT * FROM (t1 t1a); SELECT * FROM (t1 t1a);
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 ')' at line 1
1
2
SELECT * FROM ((t1 t1a)); SELECT * FROM ((t1 t1a));
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 '))' at line 1
1
2
SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1; SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1;
a t1a a t1a
1 1 1 1
@ -5295,11 +5284,14 @@ SELECT ( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ), a FROM t1;
SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2); SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2);
a b a b
SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ); SELECT 1 UNION ( SELECT 1 UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 1
1
( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
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 'UNION SELECT 1 ) UNION SELECT 1' at line 1 1
1
SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) )
1
SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
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 'UNION SELECT 1' at line 1 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 'UNION SELECT 1' at line 1
SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ); SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
@ -5309,9 +5301,9 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
((SELECT 1 UNION SELECT 1 UNION SELECT 1)) ((SELECT 1 UNION SELECT 1 UNION SELECT 1))
1 1
SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 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 '' at line 1
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
ERROR 42000: Every derived table must have its own alias 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 '' at line 1
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a; SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a;
1 1
1 1
@ -5319,19 +5311,25 @@ SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
1 1
1 1
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 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 'UNION SELECT 1 )' at line 1
SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1 a
1
SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1 a
1
SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 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 'UNION SELECT 1 )' at line 1
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );

View File

@ -182,7 +182,8 @@ select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
a b a b
1 7 1 7
2 7 2 7
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3; (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
union (select * from t4 order by a limit 2) order by a limit 3;
a b a b
1 7 1 7
2 7 2 7
@ -3725,7 +3726,7 @@ SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
i i
SELECT * FROM t1 SELECT * FROM t1
WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
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 'UNION (SELECT i FROM t1)))' at line 2 i
explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12)) explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
from t1; from t1;
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 'union (select t12.i from t1 t12)) 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 'union (select t12.i from t1 t12))
@ -5182,35 +5183,23 @@ a 1
1 1 1 1
2 1 2 1
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1; SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
ERROR 42000: Every derived table must have its own alias 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 'ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1; SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
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 'SELECT 1) ON 1' at line 1 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 'UNION SELECT 1) ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1; SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
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 'SELECT 1)) ON 1' at line 1 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 'UNION SELECT 1)) ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1; SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
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 't1a ON 1' at line 1 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 ') t1a ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
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 't1a ON 1' at line 1 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 ')) t1a ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) ON 1; SELECT * FROM t1 JOIN (t1 t1a) ON 1;
a 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 ') ON 1' at line 1
1 1
2 1
1 2
2 2
SELECT * FROM t1 JOIN ((t1 t1a)) ON 1; SELECT * FROM t1 JOIN ((t1 t1a)) ON 1;
a 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 ')) ON 1' at line 1
1 1
2 1
1 2
2 2
SELECT * FROM (t1 t1a); SELECT * FROM (t1 t1a);
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 ')' at line 1
1
2
SELECT * FROM ((t1 t1a)); SELECT * FROM ((t1 t1a));
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 '))' at line 1
1
2
SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1; SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1;
a t1a a t1a
1 1 1 1
@ -5285,11 +5274,14 @@ SELECT ( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ), a FROM t1;
SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2); SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2);
a b a b
SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ); SELECT 1 UNION ( SELECT 1 UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 1
1
( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
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 'UNION SELECT 1 ) UNION SELECT 1' at line 1 1
1
SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) )
1
SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1; SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
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 'UNION SELECT 1' at line 1 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 'UNION SELECT 1' at line 1
SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ); SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
@ -5299,9 +5291,9 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
((SELECT 1 UNION SELECT 1 UNION SELECT 1)) ((SELECT 1 UNION SELECT 1 UNION SELECT 1))
1 1
SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 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 '' at line 1
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
ERROR 42000: Every derived table must have its own alias 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 '' at line 1
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a; SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a;
1 1
1 1
@ -5309,19 +5301,25 @@ SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
1 1
1 1
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
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 'UNION SELECT 1 ) )' at line 1 a
1
SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 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 'UNION SELECT 1 )' at line 1
SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1 a
1
SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1 a
1
SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
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 'UNION SELECT 1 )' at line 1 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 'UNION SELECT 1 )' at line 1
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ); SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );

View File

@ -1675,7 +1675,7 @@ CREATE TABLE t3 ( f11 int) ;
INSERT IGNORE INTO t3 VALUES (0); INSERT IGNORE INTO t3 VALUES (0);
SELECT alias1.f11 AS field2 SELECT alias1.f11 AS field2
FROM ( t3 AS alias2 JOIN t1 AS alias3 ON alias3.f10 = 1) FROM ( t3 AS alias2 JOIN t1 AS alias3 ON alias3.f10 = 1)
LEFT JOIN ( t2 AS alias1 ) ON alias3.f11 = 1 LEFT JOIN t2 AS alias1 ON alias3.f11 = 1
WHERE alias2.f11 IN ( SELECT f11 FROM t2 ) WHERE alias2.f11 IN ( SELECT f11 FROM t2 )
GROUP BY field2 ; GROUP BY field2 ;
field2 field2

View File

@ -1462,7 +1462,7 @@ INSERT IGNORE INTO t3 VALUES (0);
SELECT alias1.f11 AS field2 SELECT alias1.f11 AS field2
FROM ( t3 AS alias2 JOIN t1 AS alias3 ON alias3.f10 = 1) FROM ( t3 AS alias2 JOIN t1 AS alias3 ON alias3.f10 = 1)
LEFT JOIN ( t2 AS alias1 ) ON alias3.f11 = 1 LEFT JOIN t2 AS alias1 ON alias3.f11 = 1
WHERE alias2.f11 IN ( SELECT f11 FROM t2 ) WHERE alias2.f11 IN ( SELECT f11 FROM t2 )
GROUP BY field2 ; GROUP BY field2 ;

View File

@ -1688,7 +1688,7 @@ CREATE TABLE t3 ( f11 int) ;
INSERT IGNORE INTO t3 VALUES (0); INSERT IGNORE INTO t3 VALUES (0);
SELECT alias1.f11 AS field2 SELECT alias1.f11 AS field2
FROM ( t3 AS alias2 JOIN t1 AS alias3 ON alias3.f10 = 1) FROM ( t3 AS alias2 JOIN t1 AS alias3 ON alias3.f10 = 1)
LEFT JOIN ( t2 AS alias1 ) ON alias3.f11 = 1 LEFT JOIN t2 AS alias1 ON alias3.f11 = 1
WHERE alias2.f11 IN ( SELECT f11 FROM t2 ) WHERE alias2.f11 IN ( SELECT f11 FROM t2 )
GROUP BY field2 ; GROUP BY field2 ;
field2 field2

View File

@ -2219,11 +2219,11 @@ drop database mysqltest4;
# (both 1st and further executions) # (both 1st and further executions)
CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM; CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
INSERT INTO t1 VALUES (0),(8); INSERT INTO t1 VALUES (0),(8);
SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2)); SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM t1 AS t2);
a a
0 0
PREPARE stmt FROM " PREPARE stmt FROM "
SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2)) SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM t1 AS t2)
"; ";
execute stmt; execute stmt;
a a

View File

@ -1848,9 +1848,9 @@ drop database mysqltest4;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM; CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
INSERT INTO t1 VALUES (0),(8); INSERT INTO t1 VALUES (0),(8);
SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2)); SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM t1 AS t2);
PREPARE stmt FROM " PREPARE stmt FROM "
SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2)) SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM t1 AS t2)
"; ";
execute stmt; execute stmt;
execute stmt; execute stmt;

View File

@ -366,7 +366,6 @@ values (1,2);
1 2 1 2
1 2 1 2
3 4 3 4
1 2
# combination of different structures that uses VALUES structures : UNION + UNION ALL # combination of different structures that uses VALUES structures : UNION + UNION ALL
values (1,2),(3,4) values (1,2),(3,4)
union all union all

View File

@ -736,6 +736,8 @@ select user() into user;
set NEW.username = user; set NEW.username = user;
select count(*) from ((select 1) union (select 2)) as d1 into i; select count(*) from ((select 1) union (select 2)) as d1 into i;
end| end|
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
update t1 set data = 1; update t1 set data = 1;
connection addconroot1; connection addconroot1;
update t1 set data = 2; update t1 set data = 2;
@ -2084,6 +2086,8 @@ FOR EACH ROW BEGIN
SELECT 1 FROM t1 c WHERE SELECT 1 FROM t1 c WHERE
(@bug51650 IS NULL OR @bug51650 != c.b) AND c.b = NEW.a LIMIT 1 INTO @foo; (@bug51650 IS NULL OR @bug51650 != c.b) AND c.b = NEW.a LIMIT 1 INTO @foo;
END// END//
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
SET @bug51650 = 1; SET @bug51650 = 1;
INSERT IGNORE INTO t2 VALUES(); INSERT IGNORE INTO t2 VALUES();
INSERT IGNORE INTO t1 SET b = '777'; INSERT IGNORE INTO t1 SET b = '777';

View File

@ -81,7 +81,7 @@ a b
2 b 2 b
1 a 1 a
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b; (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
ERROR 42000: Table 't1' from one of the SELECTs cannot be used in global ORDER clause ERROR 42000: Table 't1' from one of the SELECTs cannot be used in ORDER clause
explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc; explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00 1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00
@ -494,7 +494,7 @@ drop temporary table t1;
create table t1 select a from t1 union select a from t2; create table t1 select a from t1 union select a from t2;
ERROR 42S01: Table 't1' already exists ERROR 42S01: Table 't1' already exists
select a from t1 union select a from t2 order by t2.a; select a from t1 union select a from t2 order by t2.a;
ERROR 42000: Table 't2' from one of the SELECTs cannot be used in field list ERROR 42000: Table 't2' from one of the SELECTs cannot be used in ORDER clause
drop table t1,t2; drop table t1,t2;
select length(version()) > 1 as `*` UNION select 2; select length(version()) > 1 as `*` UNION select 2;
* *
@ -1532,12 +1532,15 @@ SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test;
ERROR 42S22: Unknown column 'c' in 'order clause' ERROR 42S22: Unknown column 'c' in 'order clause'
DROP TABLE t1; DROP TABLE t1;
(select 1 into @var) union (select 1); (select 1 into @var) union (select 1);
ERROR HY000: Incorrect usage of UNION and INTO 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 'into @var) union (select 1)' at line 1
(select 1) union (select 1 into @var); (select 1) union (select 1 into @var);
select @var; 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 'into @var)' at line 1
@var
1
(select 2) union (select 1 into @var); (select 2) union (select 1 into @var);
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 'into @var)' at line 1
(select 1) union (select 1) into @var;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
(select 2) union (select 1) into @var;
ERROR 42000: Result consisted of more than one row ERROR 42000: Result consisted of more than one row
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (10), (20); INSERT INTO t1 VALUES (10), (20);
@ -1663,8 +1666,20 @@ UNION
SELECT a FROM t1 WHERE 0 SELECT a FROM t1 WHERE 0
) alias; ) alias;
SELECT a FROM t1 UNION SELECT a INTO @v FROM t1; SELECT a FROM t1 UNION SELECT a INTO @v FROM t1;
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 'FROM t1' at line 1
SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1; SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1;
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 'FROM t1' at line 1
SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1; SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1;
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 'FROM t1' at line 1
SELECT a FROM t1 UNION SELECT a FROM t1 INTO @v ;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
SELECT a FROM t1 UNION SELECT a FROM t1 INTO OUTFILE 'union.out.file5';
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
SELECT a FROM t1 UNION SELECT a FROM t1 INTO OUTFILE 'union.out.file6';
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
SELECT a INTO @v FROM t1 UNION SELECT a FROM t1; SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
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 'UNION SELECT a FROM t1' at line 1 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 'UNION SELECT a FROM t1' at line 1
SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1; SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1;
@ -2019,14 +2034,14 @@ SET @@global.slow_query_log= @old_slow_query_log;
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int); CREATE TABLE t2 (b int);
CREATE TABLE t3 (c int); CREATE TABLE t3 (c int);
SELECT a FROM t1 UNION SELECT b FROM t2 JOIN (t3) ON ( t2.b = t3.c ); SELECT a FROM t1 UNION SELECT b FROM t2 JOIN t3 ON ( t2.b = t3.c );
a a
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
CREATE TABLE t1 (pk int NOT NULL); CREATE TABLE t1 (pk int NOT NULL);
CREATE TABLE t2 (pk int NOT NULL, fk int NOT NULL); CREATE TABLE t2 (pk int NOT NULL, fk int NOT NULL);
SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk) SELECT t1.pk FROM t1 LEFT JOIN t2 ON (t1.pk = t2.fk)
UNION UNION
SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk); SELECT t1.pk FROM t1 LEFT JOIN t2 ON (t1.pk = t2.fk);
pk pk
DROP TABLE t1,t2; DROP TABLE t1,t2;
create table t1 (a int); create table t1 (a int);

View File

@ -973,13 +973,17 @@ DROP TABLE t1;
# #
# Bug#23345: Wrongly allowed INTO in a non-last select of a UNION. # Bug#23345: Wrongly allowed INTO in a non-last select of a UNION.
# (fixed)
# #
--error 1221 --error ER_PARSE_ERROR
(select 1 into @var) union (select 1); (select 1 into @var) union (select 1);
--error ER_PARSE_ERROR
(select 1) union (select 1 into @var); (select 1) union (select 1 into @var);
select @var; --error ER_PARSE_ERROR
--error 1172
(select 2) union (select 1 into @var); (select 2) union (select 1 into @var);
(select 1) union (select 1) into @var;
--error ER_TOO_MANY_ROWS
(select 2) union (select 1) into @var;
# #
# Bug#27848: order-by of union clashes with rollup of select part # Bug#27848: order-by of union clashes with rollup of select part
@ -1099,9 +1103,15 @@ SELECT a INTO DUMPFILE 'union.out.file2' FROM (
SELECT a FROM t1 WHERE 0 SELECT a FROM t1 WHERE 0
) alias; ) alias;
--error ER_PARSE_ERROR
SELECT a FROM t1 UNION SELECT a INTO @v FROM t1; SELECT a FROM t1 UNION SELECT a INTO @v FROM t1;
--error ER_PARSE_ERROR
SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1; SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1;
--error ER_PARSE_ERROR
SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1; SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1;
SELECT a FROM t1 UNION SELECT a FROM t1 INTO @v ;
SELECT a FROM t1 UNION SELECT a FROM t1 INTO OUTFILE 'union.out.file5';
SELECT a FROM t1 UNION SELECT a FROM t1 INTO OUTFILE 'union.out.file6';
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
SELECT a INTO @v FROM t1 UNION SELECT a FROM t1; SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
@ -1361,15 +1371,15 @@ SET @@global.slow_query_log= @old_slow_query_log;
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int); CREATE TABLE t2 (b int);
CREATE TABLE t3 (c int); CREATE TABLE t3 (c int);
SELECT a FROM t1 UNION SELECT b FROM t2 JOIN (t3) ON ( t2.b = t3.c ); SELECT a FROM t1 UNION SELECT b FROM t2 JOIN t3 ON ( t2.b = t3.c );
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
CREATE TABLE t1 (pk int NOT NULL); CREATE TABLE t1 (pk int NOT NULL);
CREATE TABLE t2 (pk int NOT NULL, fk int NOT NULL); CREATE TABLE t2 (pk int NOT NULL, fk int NOT NULL);
SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk) SELECT t1.pk FROM t1 LEFT JOIN t2 ON (t1.pk = t2.fk)
UNION UNION
SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk); SELECT t1.pk FROM t1 LEFT JOIN t2 ON (t1.pk = t2.fk);
DROP TABLE t1,t2; DROP TABLE t1,t2;

View File

@ -65,3 +65,57 @@ SELECT * FROM t1;
a_id b_id c_id a_id b_id c_id
1 NULL NULL 1 NULL NULL
drop table t1,t2; drop table t1,t2;
CREATE OR REPLACE TABLE t1 (a INT NOT NULL PRIMARY KEY) engine=innodb;
CREATE OR REPLACE TABLE t2 (a INT NOT NULL PRIMARY KEY) engine=innodb;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
BEGIN;
SELECT * FROM t1 UNION
SELECT * FROM t2 FOR UPDATE;
a
1
2
connect con2,localhost,root,,;
BEGIN;
SELECT * FROM t2 FOR UPDATE;;
connection default;
select * from t2;
a
2
update t2 set a=a+100;
commit;
connection con2;
a
102
commit;
connection default;
drop table t1,t2;
CREATE OR REPLACE TABLE t1 (a INT NOT NULL PRIMARY KEY) engine=innodb;
CREATE OR REPLACE TABLE t2 (a INT NOT NULL PRIMARY KEY) engine=innodb;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
BEGIN;
SELECT * FROM (
SELECT * FROM t1 UNION
SELECT * FROM t2 FOR UPDATE
) t;
a
1
2
connection con2;
BEGIN;
SELECT * FROM t2 FOR UPDATE;;
connection default;
select * from t2;
a
2
update t2 set a=a+100;
commit;
connection con2;
a
102
commit;
connection default;
disconnect con2;
drop table t1,t2;
# End of 10.4 tests

View File

@ -75,3 +75,62 @@ SELECT t2.b_id FROM t1,t2 WHERE t2.c_id = t1.c_id;
UPDATE t1 SET b_id = (SELECT t2.b_id FROM t2 t2 WHERE t2.c_id = t1.c_id); UPDATE t1 SET b_id = (SELECT t2.b_id FROM t2 t2 WHERE t2.c_id = t1.c_id);
SELECT * FROM t1; SELECT * FROM t1;
drop table t1,t2; drop table t1,t2;
--source include/have_innodb.inc
CREATE OR REPLACE TABLE t1 (a INT NOT NULL PRIMARY KEY) engine=innodb;
CREATE OR REPLACE TABLE t2 (a INT NOT NULL PRIMARY KEY) engine=innodb;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
BEGIN;
SELECT * FROM t1 UNION
SELECT * FROM t2 FOR UPDATE;
--connect(con2,localhost,root,,)
BEGIN;
--send SELECT * FROM t2 FOR UPDATE;
--connection default
select * from t2;
update t2 set a=a+100;
commit;
--connection con2
--reap
commit;
--connection default
drop table t1,t2;
CREATE OR REPLACE TABLE t1 (a INT NOT NULL PRIMARY KEY) engine=innodb;
CREATE OR REPLACE TABLE t2 (a INT NOT NULL PRIMARY KEY) engine=innodb;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
BEGIN;
SELECT * FROM (
SELECT * FROM t1 UNION
SELECT * FROM t2 FOR UPDATE
) t;
--connection con2
BEGIN;
--send SELECT * FROM t2 FOR UPDATE;
--connection default
select * from t2;
update t2 set a=a+100;
commit;
--connection con2
--reap
commit;
--connection default
disconnect con2;
drop table t1,t2;
--echo # End of 10.4 tests

View File

@ -1,5 +1,7 @@
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
select variable_value from information_schema.global_status where variable_name="handler_read_key" into @global_read_key; select variable_value from information_schema.global_status where variable_name="handler_read_key" into @global_read_key;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
show columns from information_schema.client_statistics; show columns from information_schema.client_statistics;
Field Type Null Key Default Extra Field Type Null Key Default Extra
CLIENT varchar(64) NO CLIENT varchar(64) NO

View File

@ -2443,6 +2443,8 @@ SELECT Meaning FROM v1 INTO retn;
RETURN retn; RETURN retn;
END END
// //
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CREATE VIEW v2 AS SELECT f1(); CREATE VIEW v2 AS SELECT f1();
select * from v2; select * from v2;
f1() f1()
@ -2614,6 +2616,8 @@ declare mx int;
select max(a) from t1 into mx; select max(a) from t1 into mx;
return mx; return mx;
end// end//
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create view v1 as select f1() as a; create view v1 as select f1() as a;
create view v2 as select * from v1; create view v2 as select * from v1;
drop table t1; drop table t1;
@ -3152,10 +3156,14 @@ DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1;
SELECT * FROM (SELECT 1) AS t into @w; SELECT * FROM (SELECT 1) AS t into @w;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CREATE VIEW v1 AS SELECT * FROM (SELECT 1) AS t into @w; CREATE VIEW v1 AS SELECT * FROM (SELECT 1) AS t into @w;
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 'into @w' at line 1 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 'into @w' at line 1
# Previously the following would fail. # Previously the following would fail.
SELECT * FROM (SELECT 1) AS t into @w; SELECT * FROM (SELECT 1) AS t into @w;
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
drop view if exists view_24532_a; drop view if exists view_24532_a;
drop view if exists view_24532_b; drop view if exists view_24532_b;
drop table if exists table_24532; drop table if exists table_24532;
@ -3952,6 +3960,8 @@ BEGIN
SELECT a FROM v2 INTO @a; SELECT a FROM v2 INTO @a;
RETURN @a; RETURN @a;
END// END//
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Trigger pre-locking when opening v2. # Trigger pre-locking when opening v2.
CREATE VIEW v1 AS SELECT f1() FROM t1; CREATE VIEW v1 AS SELECT f1() FROM t1;
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
@ -4093,7 +4103,7 @@ LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
; ;
SELECT 1 SELECT 1
FROM (( SELECT 1 FROM ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4101,8 +4111,8 @@ LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t1) ) t1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4110,8 +4120,8 @@ LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t2) ON 1=1 ) t2 ON 1=1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4119,8 +4129,8 @@ LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t3) ON 1=1 ) t3 ON 1=1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4128,8 +4138,8 @@ LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t4) ON 1=1 ) t4 ON 1=1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4137,8 +4147,8 @@ LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t5) ON 1=1 ) t5 ON 1=1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4146,8 +4156,8 @@ LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t6) ON 1=1 ) t6 ON 1=1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4155,8 +4165,8 @@ LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t7) ON 1=1 ) t7 ON 1=1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4164,18 +4174,18 @@ LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t8) ON 1=1 ) t8 ON 1=1
; ;
1 1
SELECT 1 SELECT 1
FROM (v1 t1) FROM v1 t1
LEFT OUTER JOIN (v1 t2) ON 1=1 LEFT OUTER JOIN v1 t2 ON 1=1
LEFT OUTER JOIN (v1 t3) ON 1=1 LEFT OUTER JOIN v1 t3 ON 1=1
LEFT OUTER JOIN (v1 t4) ON 1=1 LEFT OUTER JOIN v1 t4 ON 1=1
LEFT OUTER JOIN (v1 t5) ON 1=1 LEFT OUTER JOIN v1 t5 ON 1=1
LEFT OUTER JOIN (v1 t6) ON 1=1 LEFT OUTER JOIN v1 t6 ON 1=1
LEFT OUTER JOIN (v1 t7) ON 1=1 LEFT OUTER JOIN v1 t7 ON 1=1
LEFT OUTER JOIN (v1 t8) ON 1=1 LEFT OUTER JOIN v1 t8 ON 1=1
; ;
1 1
drop view v1; drop view v1;

View File

@ -4042,7 +4042,7 @@ CREATE OR REPLACE view v1 AS
; ;
SELECT 1 SELECT 1
FROM (( SELECT 1 FROM ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4050,8 +4050,8 @@ FROM (( SELECT 1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t1) ) t1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4059,8 +4059,8 @@ LEFT OUTER JOIN (( SELECT 1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t2) ON 1=1 ) t2 ON 1=1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4068,8 +4068,8 @@ LEFT OUTER JOIN (( SELECT 1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t3) ON 1=1 ) t3 ON 1=1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4077,8 +4077,8 @@ LEFT OUTER JOIN (( SELECT 1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t4) ON 1=1 ) t4 ON 1=1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4086,8 +4086,8 @@ LEFT OUTER JOIN (( SELECT 1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t5) ON 1=1 ) t5 ON 1=1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4095,8 +4095,8 @@ LEFT OUTER JOIN (( SELECT 1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t6) ON 1=1 ) t6 ON 1=1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4104,8 +4104,8 @@ LEFT OUTER JOIN (( SELECT 1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t7) ON 1=1 ) t7 ON 1=1
LEFT OUTER JOIN (( SELECT 1 LEFT OUTER JOIN ( SELECT 1
FROM t1 a_alias_1 FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
@ -4113,18 +4113,18 @@ LEFT OUTER JOIN (( SELECT 1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t8) ON 1=1 ) t8 ON 1=1
; ;
SELECT 1 SELECT 1
FROM (v1 t1) FROM v1 t1
LEFT OUTER JOIN (v1 t2) ON 1=1 LEFT OUTER JOIN v1 t2 ON 1=1
LEFT OUTER JOIN (v1 t3) ON 1=1 LEFT OUTER JOIN v1 t3 ON 1=1
LEFT OUTER JOIN (v1 t4) ON 1=1 LEFT OUTER JOIN v1 t4 ON 1=1
LEFT OUTER JOIN (v1 t5) ON 1=1 LEFT OUTER JOIN v1 t5 ON 1=1
LEFT OUTER JOIN (v1 t6) ON 1=1 LEFT OUTER JOIN v1 t6 ON 1=1
LEFT OUTER JOIN (v1 t7) ON 1=1 LEFT OUTER JOIN v1 t7 ON 1=1
LEFT OUTER JOIN (v1 t8) ON 1=1 LEFT OUTER JOIN v1 t8 ON 1=1
; ;
drop view v1; drop view v1;

View File

@ -406,6 +406,8 @@ create table t2 (s1 int);
drop function if exists f2; drop function if exists f2;
create function f2 () returns int begin declare v int; select s1 from t2 create function f2 () returns int begin declare v int; select s1 from t2
into v; return v; end// into v; return v; end//
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create algorithm=TEMPTABLE view v1 as select f2() from t1; create algorithm=TEMPTABLE view v1 as select f2() from t1;
create algorithm=MERGE view v2 as select f2() from t1; create algorithm=MERGE view v2 as select f2() from t1;
create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select f2() from t1; create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select f2() from t1;
@ -449,6 +451,8 @@ create table t2 (s1 int);
drop function if exists f2; drop function if exists f2;
create function f2 () returns int begin declare v int; select s1 from t2 create function f2 () returns int begin declare v int; select s1 from t2
into v; return v; end// into v; return v; end//
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create user mysqltest_1@localhost; create user mysqltest_1@localhost;
grant select on t1 to mysqltest_1@localhost; grant select on t1 to mysqltest_1@localhost;
grant execute on function f2 to mysqltest_1@localhost; grant execute on function f2 to mysqltest_1@localhost;

View File

@ -38,6 +38,10 @@ where variable_name like 'Sort_merge_passes';
variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
SORT_MERGE_PASSES WITH PASSES SORT_MERGE_PASSES WITH PASSES
include/diff_tables.inc [t21, t22] include/diff_tables.inc [t21, t22]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
drop table t21, t22; drop table t21, t22;
################################################################# #################################################################
# Try many cursors # Try many cursors
@ -72,6 +76,10 @@ where variable_name like 'Sort_merge_passes';
variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
SORT_MERGE_PASSES WITH PASSES SORT_MERGE_PASSES WITH PASSES
include/diff_tables.inc [t21, t22] include/diff_tables.inc [t21, t22]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
drop table t21, t22; drop table t21, t22;
################################################################# #################################################################
# Try having cursors pointing at different IO_CACHE pages # Try having cursors pointing at different IO_CACHE pages
@ -105,6 +113,10 @@ where variable_name like 'Sort_merge_passes';
variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
SORT_MERGE_PASSES WITH PASSES SORT_MERGE_PASSES WITH PASSES
include/diff_tables.inc [t21, t22] include/diff_tables.inc [t21, t22]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
drop table t21, t22; drop table t21, t22;
################################################################# #################################################################
drop table t10; drop table t10;

View File

@ -53,6 +53,10 @@ include/start_slave.inc
connection master; connection master;
connection slave; connection slave;
include/diff_tables.inc [master:test.t1, slave:test.t1] include/diff_tables.inc [master:test.t1, slave:test.t1]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# 8. Clean up # 8. Clean up
connection master; connection master;
SET GLOBAL debug_dbug= ""; SET GLOBAL debug_dbug= "";

View File

@ -244,6 +244,10 @@ include/start_slave.inc
connection master; connection master;
connection slave; connection slave;
include/diff_tables.inc [master:t1, slave:t1] include/diff_tables.inc [master:t1, slave:t1]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
connection master; connection master;
DROP TABLE t1; DROP TABLE t1;
DROP PROCEDURE p; DROP PROCEDURE p;

View File

@ -23,6 +23,10 @@ include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
Got one of the listed errors Got one of the listed errors
include/wait_for_slave_sql_error_and_skip.inc [errno=1590] include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
include/diff_tables.inc [master:t1,slave:t1] include/diff_tables.inc [master:t1,slave:t1]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
######################################################################################## ########################################################################################
# 2 - BEGIN - IMPLICIT COMMIT by DDL # 2 - BEGIN - IMPLICIT COMMIT by DDL
######################################################################################## ########################################################################################
@ -55,6 +59,10 @@ INSERT INTO t1 (a, data) VALUES (29, 's');;
CREATE TABLE t5 (a int); CREATE TABLE t5 (a int);
connection slave; connection slave;
include/diff_tables.inc [master:t1,slave:t1] include/diff_tables.inc [master:t1,slave:t1]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
######################################################################################## ########################################################################################
# 3 - BEGIN - COMMIT # 3 - BEGIN - COMMIT
######################################################################################## ########################################################################################
@ -69,6 +77,10 @@ Got one of the listed errors
COMMIT; COMMIT;
connection slave; connection slave;
include/diff_tables.inc [master:t1,slave:t1] include/diff_tables.inc [master:t1,slave:t1]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
######################################################################################## ########################################################################################
# 4 - BEGIN - ROLLBACK # 4 - BEGIN - ROLLBACK
######################################################################################## ########################################################################################
@ -85,6 +97,10 @@ Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back Warning 1196 Some non-transactional changed tables couldn't be rolled back
connection slave; connection slave;
include/diff_tables.inc [master:t1,slave:t1] include/diff_tables.inc [master:t1,slave:t1]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
######################################################################################## ########################################################################################
# 5 - PROCEDURE # 5 - PROCEDURE
######################################################################################## ########################################################################################
@ -111,6 +127,10 @@ Got one of the listed errors
ROLLBACK; ROLLBACK;
connection slave; connection slave;
include/diff_tables.inc [master:t1,slave:t1] include/diff_tables.inc [master:t1,slave:t1]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
######################################################################################## ########################################################################################
# 6 - XID # 6 - XID
######################################################################################## ########################################################################################
@ -131,6 +151,10 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
COMMIT; COMMIT;
connection slave; connection slave;
include/diff_tables.inc [master:t1,slave:t1] include/diff_tables.inc [master:t1,slave:t1]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
######################################################################################## ########################################################################################
# 7 - NON-TRANS TABLE # 7 - NON-TRANS TABLE
######################################################################################## ########################################################################################
@ -152,6 +176,10 @@ Got one of the listed errors
COMMIT; COMMIT;
connection slave; connection slave;
include/diff_tables.inc [master:t1,slave:t1] include/diff_tables.inc [master:t1,slave:t1]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
######################################################################## ########################################################################
# 8 - Bug#55375(Regression Bug) Transaction bigger than # 8 - Bug#55375(Regression Bug) Transaction bigger than
# max_binlog_cache_size crashes slave # max_binlog_cache_size crashes slave

View File

@ -5,6 +5,10 @@ CREATE TABLE t1(i VARCHAR(20));
INSERT INTO t1 VALUES (0xFFFF); INSERT INTO t1 VALUES (0xFFFF);
connection slave; connection slave;
include/diff_tables.inc [master:t1, slave:t1] include/diff_tables.inc [master:t1, slave:t1]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
connection master; connection master;
DROP TABLE t1; DROP TABLE t1;
include/rpl_end.inc include/rpl_end.inc

View File

@ -2,5 +2,9 @@ include/master-slave.inc
[connection master] [connection master]
include/assert.inc [Assert that relay log space is close to the limit] include/assert.inc [Assert that relay log space is close to the limit]
include/diff_tables.inc [master:test.t1,slave:test.t1] include/diff_tables.inc [master:test.t1,slave:test.t1]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
connection slave; connection slave;
include/rpl_end.inc include/rpl_end.inc

View File

@ -29,6 +29,10 @@ include/start_slave.inc
connection master; connection master;
connection slave; connection slave;
include/diff_tables.inc [master:t1,slave:t1] include/diff_tables.inc [master:t1,slave:t1]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
=====Corrupting the master.info=======; =====Corrupting the master.info=======;
connection slave; connection slave;
include/stop_slave.inc include/stop_slave.inc
@ -47,6 +51,10 @@ include/start_slave.inc
connection master; connection master;
connection slave; connection slave;
include/diff_tables.inc [master:t1,slave:t1] include/diff_tables.inc [master:t1,slave:t1]
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
=====Clean up=======; =====Clean up=======;
connection master; connection master;
drop table t1; drop table t1;

View File

@ -23,6 +23,8 @@ a:=a+1;
INSERT INTO t1 VALUES (a,'pkg1 initialization'); INSERT INTO t1 VALUES (a,'pkg1 initialization');
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL pkg1.p1; CALL pkg1.p1;
SELECT * FROM t1 ORDER BY a; SELECT * FROM t1 ORDER BY a;
a routine a routine

View File

@ -2028,6 +2028,8 @@ $$
CALL p1.p1(); CALL p1.p1();
@a @a
11 11
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1.p1(); CALL p1.p1();
@a @a
12 12
@ -2059,6 +2061,8 @@ BEGIN
SELECT MAX(a) FROM t1 INTO @a; SELECT MAX(a) FROM t1 INTO @a;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1.p1(); CALL p1.p1();
@a @a
11 11
@ -2092,6 +2096,8 @@ BEGIN
SELECT 1 FROM t1 INTO @a; SELECT 1 FROM t1 INTO @a;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1.p1(); CALL p1.p1();
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
SELECT p1.f1(); SELECT p1.f1();
@ -2650,6 +2656,9 @@ SELECT * FROM t1 INTO b;
SELECT b.a, b.b; SELECT b.a, b.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1.p1; CALL p1.p1;
b.a b.b b.a b.b
10 b 10 b

View File

@ -2833,6 +2833,8 @@ SELECT * FROM t1 INTO rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
ERROR 21000: The used SELECT statements have a different number of columns ERROR 21000: The used SELECT statements have a different number of columns
DROP TABLE t1; DROP TABLE t1;
@ -2847,6 +2849,8 @@ SELECT * FROM t1 INTO rec1, rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
ERROR 21000: Operand should contain 2 column(s) ERROR 21000: Operand should contain 2 column(s)
DROP TABLE t1; DROP TABLE t1;
@ -2861,6 +2865,8 @@ SELECT * FROM t1 INTO rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
rec1.a rec1.b rec1.a rec1.b
10 b10 10 b10
@ -2876,6 +2882,8 @@ SELECT 10,'a','b' FROM t1 INTO rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
ERROR 21000: The used SELECT statements have a different number of columns ERROR 21000: The used SELECT statements have a different number of columns
DROP TABLE t1; DROP TABLE t1;
@ -2890,6 +2898,8 @@ SELECT 10,'a' FROM t1 INTO rec1, rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
ERROR 21000: Operand should contain 2 column(s) ERROR 21000: Operand should contain 2 column(s)
DROP TABLE t1; DROP TABLE t1;
@ -2904,6 +2914,8 @@ SELECT * FROM t1 INTO rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
rec1.a rec1.b rec1.a rec1.b
10 b10 10 b10
@ -2920,6 +2932,8 @@ SELECT * FROM t1 INTO rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
ERROR 21000: The used SELECT statements have a different number of columns ERROR 21000: The used SELECT statements have a different number of columns
DROP TABLE t1; DROP TABLE t1;
@ -2935,6 +2949,8 @@ SELECT * FROM t1 INTO rec1, rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
ERROR 21000: Operand should contain 2 column(s) ERROR 21000: Operand should contain 2 column(s)
DROP TABLE t1; DROP TABLE t1;
@ -2950,6 +2966,8 @@ SELECT * FROM t1 INTO rec1;
SELECT rec1.a, rec1.b; SELECT rec1.a, rec1.b;
END; END;
$$ $$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p1(); CALL p1();
rec1.a rec1.b rec1.a rec1.b
10 b10 10 b10

View File

@ -1019,9 +1019,7 @@ LOOP
EXIT WHEN unknown_ident IS NULL; EXIT WHEN unknown_ident IS NULL;
END LOOP; END LOOP;
END$$ END$$
CALL p1;
ERROR 42S22: Unknown column 'unknown_ident' in 'field list' ERROR 42S22: Unknown column 'unknown_ident' in 'field list'
DROP PROCEDURE p1;
CREATE PROCEDURE p1 CREATE PROCEDURE p1
AS AS
BEGIN BEGIN
@ -1030,9 +1028,7 @@ LOOP
EXIT label WHEN unknown_ident IS NULL; EXIT label WHEN unknown_ident IS NULL;
END LOOP; END LOOP;
END$$ END$$
CALL p1;
ERROR 42S22: Unknown column 'unknown_ident' in 'field list' ERROR 42S22: Unknown column 'unknown_ident' in 'field list'
DROP PROCEDURE p1;
CREATE PROCEDURE p1 CREATE PROCEDURE p1
AS AS
BEGIN BEGIN
@ -1040,9 +1036,7 @@ LOOP
CONTINUE WHEN unknown_ident IS NULL; CONTINUE WHEN unknown_ident IS NULL;
END LOOP; END LOOP;
END$$ END$$
CALL p1;
ERROR 42S22: Unknown column 'unknown_ident' in 'field list' ERROR 42S22: Unknown column 'unknown_ident' in 'field list'
DROP PROCEDURE p1;
CREATE PROCEDURE p1 CREATE PROCEDURE p1
AS AS
BEGIN BEGIN
@ -1051,9 +1045,7 @@ LOOP
CONTINUE label WHEN unknown_ident IS NULL; CONTINUE label WHEN unknown_ident IS NULL;
END LOOP; END LOOP;
END$$ END$$
CALL p1;
ERROR 42S22: Unknown column 'unknown_ident' in 'field list' ERROR 42S22: Unknown column 'unknown_ident' in 'field list'
DROP PROCEDURE p1;
# #
# MDEV-10583 sql_mode=ORACLE: SQL%ROWCOUNT # MDEV-10583 sql_mode=ORACLE: SQL%ROWCOUNT
# #

View File

@ -1092,6 +1092,7 @@ DROP FUNCTION f1;
--echo # --echo #
DELIMITER $$; DELIMITER $$;
--error ER_BAD_FIELD_ERROR
CREATE PROCEDURE p1 CREATE PROCEDURE p1
AS AS
BEGIN BEGIN
@ -1100,12 +1101,10 @@ BEGIN
END LOOP; END LOOP;
END$$ END$$
DELIMITER ;$$ DELIMITER ;$$
--error ER_BAD_FIELD_ERROR
CALL p1;
DROP PROCEDURE p1;
DELIMITER $$; DELIMITER $$;
--error ER_BAD_FIELD_ERROR
CREATE PROCEDURE p1 CREATE PROCEDURE p1
AS AS
BEGIN BEGIN
@ -1115,12 +1114,10 @@ BEGIN
END LOOP; END LOOP;
END$$ END$$
DELIMITER ;$$ DELIMITER ;$$
--error ER_BAD_FIELD_ERROR
CALL p1;
DROP PROCEDURE p1;
DELIMITER $$; DELIMITER $$;
--error ER_BAD_FIELD_ERROR
CREATE PROCEDURE p1 CREATE PROCEDURE p1
AS AS
BEGIN BEGIN
@ -1129,12 +1126,10 @@ BEGIN
END LOOP; END LOOP;
END$$ END$$
DELIMITER ;$$ DELIMITER ;$$
--error ER_BAD_FIELD_ERROR
CALL p1;
DROP PROCEDURE p1;
DELIMITER $$; DELIMITER $$;
--error ER_BAD_FIELD_ERROR
CREATE PROCEDURE p1 CREATE PROCEDURE p1
AS AS
BEGIN BEGIN
@ -1144,9 +1139,6 @@ BEGIN
END LOOP; END LOOP;
END$$ END$$
DELIMITER ;$$ DELIMITER ;$$
--error ER_BAD_FIELD_ERROR
CALL p1;
DROP PROCEDURE p1;
--echo # --echo #
--echo # MDEV-10583 sql_mode=ORACLE: SQL%ROWCOUNT --echo # MDEV-10583 sql_mode=ORACLE: SQL%ROWCOUNT

View File

@ -15723,6 +15723,7 @@ Testcase 4.3.7:
DROP PROCEDURE IF EXISTS sp7; DROP PROCEDURE IF EXISTS sp7;
CREATE PROCEDURE sp7() CREATE PROCEDURE sp7()
BEGIN BEGIN
DECLARE count INT DEFAULT 100;
label1: loop label1: loop
set @dummystring = 'temp value'; set @dummystring = 'temp value';
if count > 10 then leave label1; if count > 10 then leave label1;
@ -15732,7 +15733,7 @@ END label1 loop;
END// END//
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 'iterate; 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 'iterate;
END label1 loop; END label1 loop;
END' at line 7 END' at line 8
DROP PROCEDURE IF EXISTS sp7; DROP PROCEDURE IF EXISTS sp7;
CREATE PROCEDURE sp7() CREATE PROCEDURE sp7()
BEGIN BEGIN

View File

@ -14,6 +14,7 @@ INSERT INTO t1 VALUES (1), (2), (3);
--echo --echo
--echo # -- Check 1. --echo # -- Check 1.
--disable_warnings
--enable_info --enable_info
--echo SELECT * FROM t1 INTO OUTFILE "MYSQL_TMP_DIR/bug21818.txt"; --echo SELECT * FROM t1 INTO OUTFILE "MYSQL_TMP_DIR/bug21818.txt";
--disable_query_log # to avoid $MYSQL_TMP_DIR in query log --disable_query_log # to avoid $MYSQL_TMP_DIR in query log
@ -34,6 +35,7 @@ SELECT a FROM t1 LIMIT 1 INTO @a;
--echo --echo
SELECT ROW_COUNT(); SELECT ROW_COUNT();
--enable_warnings
--echo --echo
--echo # -- Check 3. --echo # -- Check 3.

Some files were not shown because too many files have changed in this diff Show More