From 74d716876537e244ae20a71874c9e670e0cfc930 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Fri, 30 Aug 2024 10:28:28 -0700 Subject: [PATCH] MDEV-25084 Assertion failure when moving equality from having to where This bug was fixed by the patch for bug MDEV-26402. Only a test case that failed before this patch was applied is added in this commit. --- mysql-test/main/having_cond_pushdown.result | 10 ++++++++++ mysql-test/main/having_cond_pushdown.test | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/mysql-test/main/having_cond_pushdown.result b/mysql-test/main/having_cond_pushdown.result index 3531c855781..c5877da4abd 100644 --- a/mysql-test/main/having_cond_pushdown.result +++ b/mysql-test/main/having_cond_pushdown.result @@ -5187,4 +5187,14 @@ HAVING (SELECT MAX(b) FROM t1) = a AND a > b; a b 2 1 DROP TABLE t1; +# +# MDEV-25084: Moving equality with constant right side +# from HAVING to WHERE +# (fixed by the patch for MDEV-26402) +# +CREATE TABLE t1 (a CHAR(3)) CHARSET=sjis; +INSERT INTO t1 VALUES ('foo'),('bar'); +SELECT LOAD_FILE('') AS f, a FROM t1 GROUP BY f, a HAVING f = a; +f a +DROP TABLE t1; End of 10.5 tests diff --git a/mysql-test/main/having_cond_pushdown.test b/mysql-test/main/having_cond_pushdown.test index fd414e62a8c..51a346b0ad4 100644 --- a/mysql-test/main/having_cond_pushdown.test +++ b/mysql-test/main/having_cond_pushdown.test @@ -1584,4 +1584,16 @@ eval $q; DROP TABLE t1; + +--echo # +--echo # MDEV-25084: Moving equality with constant right side +--echo # from HAVING to WHERE +--echo # (fixed by the patch for MDEV-26402) +--echo # + +CREATE TABLE t1 (a CHAR(3)) CHARSET=sjis; +INSERT INTO t1 VALUES ('foo'),('bar'); +SELECT LOAD_FILE('') AS f, a FROM t1 GROUP BY f, a HAVING f = a; +DROP TABLE t1; + --echo End of 10.5 tests