1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-31305 Crash caused by query with aggregation over materialized derived

This bug was fixed by the patch for bug MDEV-30706.
Only a test case is added in this commit.
This commit is contained in:
Igor Babaev
2024-01-31 23:50:41 -08:00
parent f4ee7c110c
commit 05314ed0d4
2 changed files with 70 additions and 0 deletions

View File

@ -2795,4 +2795,40 @@ drop table t1, t2;
drop view v1;
drop procedure aproc;
--echo #
--echo # MDEV-31305: Aggregation over materialized derived table
--echo #
--source include/have_sequence.inc
CREATE VIEW v AS
SELECT seq1.seq AS dim1, seq2.seq AS dim2, seq3.seq AS dim3,
FLOOR(RAND(13) * 5) AS p
FROM seq_100_to_105 seq1
JOIN seq_10_to_15 seq2
JOIN seq_1_to_5 seq3;
SELECT v.*, SUM(p) from v;
SELECT d.*, SUM(p)
FROM (
SELECT seq1.seq AS dim1, seq2.seq AS dim2, seq3.seq AS dim3,
FLOOR(RAND(13) * 5) AS p
FROM seq_100_to_105 seq1
JOIN seq_10_to_15 seq2
JOIN seq_1_to_5 seq3
) d;
WITH demo AS
(
SELECT seq1.seq AS dim1, seq2.seq AS dim2, seq3.seq AS dim3,
FLOOR(RAND(13) * 5) AS p
FROM seq_100_to_105 seq1
JOIN seq_10_to_15 seq2
JOIN seq_1_to_5 seq3
)
SELECT d.*, SUM(p) FROM demo d;
DROP VIEW v;
--echo # End of 10.4 tests