1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Added test cases for MDEV-17017 and MDEV-16930 into compat/oracle

This commit is contained in:
Igor Babaev
2018-08-23 17:43:54 -07:00
parent b4cf8557e3
commit 2c76653849
2 changed files with 128 additions and 0 deletions

View File

@ -2099,3 +2099,87 @@ v
#
with t as (values (),()) select 1 from t;
ERROR HY000: Row with no elements is not allowed in table value constructor in this context
#
# MDEV-17017: TVC in derived table
#
create table t1 (a int);
insert into t1 values (9), (3), (2);
select * from (values (7), (5), (8), (1), (3), (8), (1)) t;
7
7
5
8
1
3
8
1
explain select * from (values (7), (5), (8), (1), (3), (8), (1)) t;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7
2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
select * from (values (1,11), (7,77), (3,31), (4,42)) t;
1 11
1 11
7 77
3 31
4 42
explain select * from (values (1,11), (7,77), (3,31), (4,42)) t;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
select * from (values (7), (5), (8), (1) union values (3), (8), (1)) t;
7
7
5
8
1
3
explain select * from (values (7), (5), (8), (1) union values (3), (8), (1)) t;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7
2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
select * from (values (7), (5), (8), (1) union select * from t1) t;
7
7
5
8
1
9
3
2
explain select * from (values (7), (5), (8), (1) union select * from t1) t;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7
2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION t1 ALL NULL NULL NULL NULL 3
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
drop table t1;
#
# MDEV-16930: expression in the first row of TVC specifying derived table
#
SELECT 1 + 1, 2, 'abc';
1 + 1 2 abc
2 2 abc
SELECT * FROM (SELECT 1 + 1, 2, 'abc') t;
1 + 1 2 abc
2 2 abc
WITH cte AS (SELECT 1 + 1, 2, 'abc') SELECT * FROM cte;
1 + 1 2 abc
2 2 abc
SELECT 1 + 1, 2, 'abc' UNION SELECT 3+4, 3, 'abc';
1 + 1 2 abc
2 2 abc
7 3 abc
CREATE VIEW v1 AS SELECT 1 + 1, 2, 'abc';
SELECT * FROM v1;
1 + 1 2 abc
2 2 abc
DROP VIEW v1;
VALUES(1 + 1,2,'abc');
1 + 1 2 abc
2 2 abc
SELECT * FROM (VALUES(1 + 1,2,'abc')) t;
1 + 1 2 abc
2 2 abc