Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6855

Assertion `cond_type == Item::FUNC_ITEM' failed in check_group_min_max_predicates with GROUP BY, aggregate in WHERE SQ, multi-part key

    Details

      Description

      Test case

      CREATE TABLE t1 (i INT, c VARCHAR(3), KEY(c,i)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (7,'foo'),(0,'bar');
       
      CREATE TABLE t2 (j INT) ENGINE=MyISAM;
      INSERT INTO t2 VALUES (0),(8),(1),(8),(9);
       
      SELECT MAX(i), c FROM t1 
      WHERE c != 'qux' AND ( SELECT SUM(j) FROM t1, t2 ) IS NOT NULL GROUP BY c;

      Stack trace from 5.5 revno 4319

      mysqld: 5.5/sql/opt_range.cc:12640: bool check_group_min_max_predicates(Item*, Item_field*, Field::imagetype, bool*, bool*): Assertion `cond_type == Item::FUNC_ITEM' failed.
      141008 16:47:02 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f5553bf76f1 in *__GI___assert_fail (assertion=0xe2bb8b "cond_type == Item::FUNC_ITEM", file=<optimized out>, line=12640, function=0xe2cda0 "bool check_group_min_max_predicates(Item*, Item_field*, Field::imagetype, bool*, bool*)") at assert.c:81
      #7  0x00000000008faebc in check_group_min_max_predicates (cond=0x7f554e589d68, min_max_arg_item=0x7f554e6871c0, image_type=Field::itRAW, has_min_max_arg=0x7f554efb021d, has_other_arg=0x7f554efb021c) at 5.5/sql/opt_range.cc:12640
      #8  0x00000000008fabf4 in check_group_min_max_predicates (cond=0x7f554e688e90, min_max_arg_item=0x7f554e6871c0, image_type=Field::itRAW, has_min_max_arg=0x7f554efb1bdb, has_other_arg=0x7f554efb1bda) at 5.5/sql/opt_range.cc:12593
      #9  0x00000000008fa7f1 in get_best_group_min_max (param=0x7f554efb1fb0, tree=0x7f554e550650, read_time=1.4321361058601134) at 5.5/sql/opt_range.cc:12494
      #10 0x00000000008e5f8f in SQL_SELECT::test_quick_select (this=0x7f554e58a048, thd=0x7f5552349060, keys_to_use=..., prev_tables=0, limit=18446744073709551615, force_quick_range=true, ordered_output=false) at 5.5/sql/opt_range.cc:3122
      #11 0x000000000068fa46 in test_if_skip_sort_order (tab=0x7f554e589860, order=0x7f554e688fc8, select_limit=2, no_changes=false, map=0x7f554e5af8e8) at 5.5/sql/sql_select.cc:19446
      #12 0x0000000000663931 in JOIN::optimize (this=0x7f554e569d98) at 5.5/sql/sql_select.cc:1723
      #13 0x00000000006682cb in mysql_select (thd=0x7f5552349060, rref_pointer_array=0x7f555234ccc8, tables=0x7f554e687580, wild_num=0, fields=..., conds=0x7f554e688e90, og_num=1, order=0x0, group=0x7f554e688fc8, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f554e689020, unit=0x7f555234c380, select_lex=0x7f555234ca58) at 5.5/sql/sql_select.cc:3080
      #14 0x000000000065ee2d in handle_select (thd=0x7f5552349060, lex=0x7f555234c2d0, result=0x7f554e689020, setup_tables_done_option=0) at 5.5/sql/sql_select.cc:319
      #15 0x00000000006383df in execute_sqlcom_select (thd=0x7f5552349060, all_tables=0x7f554e687580) at 5.5/sql/sql_parse.cc:4688
      #16 0x00000000006315c1 in mysql_execute_command (thd=0x7f5552349060) at 5.5/sql/sql_parse.cc:2233
      #17 0x000000000063aaee in mysql_parse (thd=0x7f5552349060, rawbuf=0x7f554e687078 "SELECT MAX(i), c FROM t1 WHERE c != 'qux' AND ( SELECT SUM(j) FROM t1, t2 ) IS NOT NULL GROUP BY c", length=98, parser_state=0x7f554efb5630) at 5.5/sql/sql_parse.cc:5799
      #18 0x000000000062eb39 in dispatch_command (command=COM_QUERY, thd=0x7f5552349060, packet=0x7f554f5e8061 "SELECT MAX(i), c FROM t1 WHERE c != 'qux' AND ( SELECT SUM(j) FROM t1, t2 ) IS NOT NULL GROUP BY c", packet_length=98) at 5.5/sql/sql_parse.cc:1079
      #19 0x000000000062dcc5 in do_command (thd=0x7f5552349060) at 5.5/sql/sql_parse.cc:793
      #20 0x000000000072fd42 in do_handle_one_connection (thd_arg=0x7f5552349060) at 5.5/sql/sql_connect.cc:1266
      #21 0x000000000072f801 in handle_one_connection (arg=0x7f5552349060) at 5.5/sql/sql_connect.cc:1181
      #22 0x0000000000b652fd in pfs_spawn_thread (arg=0x7f554f5518e0) at 5.5/storage/perfschema/pfs.cc:1015
      #23 0x00007f5555399b50 in start_thread (arg=<optimized out>) at pthread_create.c:304

        Attachments

          Activity

            People

            • Assignee:
              monty Michael Widenius
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: