From b76b69cd5fe634d8ddb9406aa2c82ef2a375b4d8 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Tue, 20 Jun 2017 14:55:30 +0200 Subject: MDEV-10880: Assertions `keypart_map' or `prebuilt->search_tuple->n_fields > 0' fail on DISTINCT and GROUP BY constant add_group_and_distinct_keys() should take into account JOIN::simple_group. --- mysql-test/t/order_by.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mysql-test/t/order_by.test') diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 2d0c134a2d9..f61a6a8be34 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -2091,3 +2091,15 @@ set @@optimizer_switch=@tmp_8989; set optimizer_switch='orderby_uses_equalities=on'; + +--echo # +--echo # MDEV-10880: Assertions `keypart_map' or +--echo # `prebuilt->search_tuple->n_fields > 0' fail on DISTINCT and +--echo # GROUP BY constant +--echo # + +CREATE TABLE t1 (pk INT PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT DISTINCT pk FROM t1 GROUP BY 'foo'; +SELECT DISTINCT pk FROM t1; +DROP TABLE t1; -- cgit v1.2.1