summaryrefslogtreecommitdiff
path: root/mysql-test/main/brackets.result
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2019-05-01 18:20:06 -0700
committerIgor Babaev <igor@askmonty.org>2019-05-01 18:20:06 -0700
commit2b7e080faece853f463f6f546066d54e1cbc330b (patch)
tree36357b71d6d2f89839dea44f6ad7927eee02ca30 /mysql-test/main/brackets.result
parentea679c88c323dc2c79d9b5c05d4dba9671ad62bc (diff)
downloadmariadb-git-2b7e080faece853f463f6f546066d54e1cbc330b.tar.gz
MDEV-19363 Assertion `select_lex' failed in LEX::pop_select
This patch corrects the patch for MDEV-19324. The latter did not work properly in the cases when the transformation (SELECT ... ORDER BY ...) LIMIT ... => SELECT ... ORDER BY ... LIMIT ... was applied to the operands of a set operation.
Diffstat (limited to 'mysql-test/main/brackets.result')
-rw-r--r--mysql-test/main/brackets.result59
1 files changed, 59 insertions, 0 deletions
diff --git a/mysql-test/main/brackets.result b/mysql-test/main/brackets.result
index 3cf3468320f..869afe56c9c 100644
--- a/mysql-test/main/brackets.result
+++ b/mysql-test/main/brackets.result
@@ -393,4 +393,63 @@ EXPLAIN
}
}
drop table t1;
+#
+# MDEV-19363: ((SELECT ...) ORDER BY col ) LIMIT n UNION ...
+#
+create table t1 (pk int);
+insert into t1 values (5),(4),(1),(2),(3);
+((select * from t1 order by pk) limit 2) union (select * from t1 where pk > 4);
+pk
+1
+2
+5
+explain extended ((select * from t1 order by pk) limit 2) union (select * from t1 where pk > 4);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using filesort
+2 UNION t1 ALL NULL NULL NULL NULL 5 100.00 Using where
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 (/* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` order by `test`.`t1`.`pk` limit 2) union (/* select#2 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where `test`.`t1`.`pk` > 4)
+explain format=json ((select * from t1 order by pk) limit 2) union (select * from t1 where pk > 4);
+EXPLAIN
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<union1,2>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.pk",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "UNION",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.pk > 4"
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+drop table t1;
# End of 10.4 tests