Skip to content

Commit

Permalink
Added the test case for MDEV-23804
Browse files Browse the repository at this point in the history
  • Loading branch information
Varun Gupta committed Jan 12, 2021
1 parent 5a1a714 commit 1be7072
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
70 changes: 70 additions & 0 deletions mysql-test/main/derived_cond_pushdown.result
Original file line number Diff line number Diff line change
Expand Up @@ -17064,4 +17064,74 @@ id
2
3
DROP TABLE t;
#
# MDEV-23804: Server crashes in st_select_lex::collect_grouping_fields_for_derived
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (3),(4);
CREATE VIEW v1 AS SELECT a FROM t1 UNION VALUES (3),(4);
ANALYZE FORMAT=JSON SELECT * from v1 WHERE a=3;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 2,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 50,
"attached_condition": "v1.a = 3",
"materialized": {
"query_block": {
"union_result": {
"table_name": "<union2,3>",
"access_type": "ALL",
"r_loops": 1,
"r_rows": 2,
"query_specifications": [
{
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 50,
"attached_condition": "t1.a = 3"
}
}
},
{
"query_block": {
"select_id": 3,
"operation": "UNION",
"table": {
"message": "No tables used"
}
}
}
]
}
}
}
}
}
}
SELECT * from v1 WHERE a=3;
a
3
DROP VIEW v1;
DROP TABLE t1;
# End of 10.3 tests
13 changes: 13 additions & 0 deletions mysql-test/main/derived_cond_pushdown.test
Original file line number Diff line number Diff line change
Expand Up @@ -3466,4 +3466,17 @@ eval set statement optimizer_switch='split_materialized=on' for $q;

DROP TABLE t;

--echo #
--echo # MDEV-23804: Server crashes in st_select_lex::collect_grouping_fields_for_derived
--echo #

CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (3),(4);
CREATE VIEW v1 AS SELECT a FROM t1 UNION VALUES (3),(4);
--source include/analyze-format.inc
ANALYZE FORMAT=JSON SELECT * from v1 WHERE a=3;
SELECT * from v1 WHERE a=3;
DROP VIEW v1;
DROP TABLE t1;

--echo # End of 10.3 tests

0 comments on commit 1be7072

Please sign in to comment.