summaryrefslogtreecommitdiff
path: root/mysql-test/main/union.test
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-10-14 08:29:11 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2022-10-14 08:29:11 +0200
commit89e3815b395e29a0e2c282a08ed6326a3330a2aa (patch)
tree7343733389a1868b516f6ab0a1433998f96642d7 /mysql-test/main/union.test
parent1f5615360cce22875ae2ab92386704b2ba363d8b (diff)
parent72ba96a48eb3e99a967e0489cc79f378e865e3fd (diff)
downloadmariadb-git-89e3815b395e29a0e2c282a08ed6326a3330a2aa.tar.gz
Merge branch 'bb-10.3-vp-MDEV-27691' into 10.3
Diffstat (limited to 'mysql-test/main/union.test')
-rw-r--r--mysql-test/main/union.test20
1 files changed, 19 insertions, 1 deletions
diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test
index a523ba70c79..a3a672e2937 100644
--- a/mysql-test/main/union.test
+++ b/mysql-test/main/union.test
@@ -26,6 +26,7 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
--error 1250
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
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;
+--disable_view_protocol
select count(*) from (
(select a,b from t1 limit 2) union all (select a,b from t2 order by a)) q;
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
@@ -34,7 +35,7 @@ select count(*) from (
select a,b from t1 union all select a,b from t2) q;
select sql_calc_found_rows a,b from t1 union all select a,b from t2 limit 2;
select found_rows();
-
+--enable_view_protocol
#
# Test some error conditions with UNION
#
@@ -209,6 +210,7 @@ insert into t1 values (1),(2),(3);
create table t2 (a int);
insert into t2 values (3),(4),(5);
+--disable_view_protocol
# Test global limits
SELECT COUNT(*) FROM (
(SELECT * FROM t1) UNION all (SELECT * FROM t2)) q;
@@ -234,12 +236,15 @@ SELECT COUNT(*) FROM (
(SELECT * FROM t1 LIMIT 1) UNION SELECT * FROM t2) q;
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1;
select found_rows();
+--enable_view_protocol
# In these case found_rows() should work
--error ER_PARSE_ERROR
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2;
+--disable_view_protocol
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION all SELECT * FROM t2 LIMIT 2;
select found_rows();
+--enable_view_protocol
# The following examples will not be exact
SELECT COUNT(*) FROM (
@@ -247,12 +252,16 @@ SELECT * FROM t1 UNION SELECT * FROM t2) q;
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2;
SELECT COUNT(*) FROM (
(SELECT * FROM t1 LIMIT 1) UNION all SELECT * FROM t2) q;
+--disable_view_protocol
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all SELECT * FROM t2 LIMIT 2;
select found_rows();
+--enable_view_protocol
SELECT COUNT(*) FROM (
SELECT * FROM t1 UNION all SELECT * FROM t2) q;
+--disable_view_protocol
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 100;
select found_rows();
+--enable_view_protocol
--error ER_PARSE_ERROR
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 100 UNION SELECT * FROM t2;
SELECT COUNT(*) FROM (
@@ -268,8 +277,10 @@ SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2 LIMIT 2;
SELECT COUNT(*) FROM (
(SELECT * FROM t1 LIMIT 1) UNION SELECT * FROM t2) q;
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 2;
+--disable_view_protocol
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2,2;
select found_rows();
+--enable_view_protocol
SELECT COUNT(*) FROM (
SELECT * FROM t1 UNION SELECT * FROM t2) q;
--error ER_PARSE_ERROR
@@ -501,6 +512,7 @@ insert t1 select a+1, a+b from t1;
insert t1 select a+1, a+b from t1;
insert t1 select a+1, a+b from t1;
FLUSH STATUS;
+--disable_view_protocol
show status like 'Slow_queries';
select count(*) from t1 where a=7;
show status like 'Slow_queries';
@@ -514,6 +526,7 @@ show status like 'Slow_queries';
flush status;
select a from t1 where b not in (1,2,3) union select a from t1 where b not in (4,5,6);
show status like 'Slow_queries';
+--enable_view_protocol
drop table t1;
#
@@ -1348,8 +1361,10 @@ INSERT INTO t2 VALUES (4), (5), (6);
INSERT INTO t3 VALUES (7), (8), (9);
TRUNCATE table mysql.slow_log;
--sorted_result
+--disable_view_protocol
SELECT * FROM t17059925 UNION SELECT * FROM t2 UNION SELECT * FROM t3;
SELECT sql_text, rows_examined FROM mysql.slow_log WHERE sql_text LIKE '%SELECT%t17059925%';
+--enable_view_protocol
DROP TABLE t17059925, t2, t3;
## Reset to initial values
@@ -1862,6 +1877,7 @@ drop table t1,t2,t3;
--disable_ps_protocol
--enable_metadata
+--disable_view_protocol
SELECT CAST(1 AS UNSIGNED) UNION ALL SELECT * from (SELECT NULL) t;
SELECT CAST(1 AS SIGNED) UNION ALL SELECT * from (SELECT NULL) t;
@@ -1870,6 +1886,7 @@ SELECT CAST(1 AS SIGNED) UNION ALL SELECT * from (SELECT CAST(1 AS UNSIGNED)) t;
SELECT CAST(1 AS UNSIGNED) UNION ALL SELECT NULL;
SELECT CAST(1 AS UNSIGNED) UNION ALL SELECT CAST(1 AS SIGNED);
+--enable_view_protocol
--disable_metadata
--enable_ps_protocol
@@ -1898,6 +1915,7 @@ DROP TABLE t1, t2, t3, t4;
set @@default_storage_engine=@save_default_storage_engine;
+
--echo #
--echo # MDEV-29022: add_slave destroy child list and has dead code
--echo # (test added to be sure that ordering by several subqueries works)