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

【BUG】【core dump】group by + having = core dump

    XMLWordPrintable

Details

    Description

      【重现步骤】
      1、创建表 t1
      CREATE TABLE `t1` (
      `col_int` int(11) DEFAULT NULL,
      `col_varchar_16` varchar(16) COLLATE utf8mb4_bin DEFAULT NULL,
      `col_varchar_16_key` varchar(16) COLLATE utf8mb4_bin DEFAULT NULL,
      `pk` int(11) NOT NULL AUTO_INCREMENT,
      `col_int_key` int(11) DEFAULT NULL,
      PRIMARY KEY (`pk`),
      KEY `col_varchar_16_key` (`col_varchar_16_key`),
      KEY `col_int_key` (`col_int_key`)
      ) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

      2、执行以下查询
      SELECT DISTINCT col_varchar_16_key AS field1 , COUNT( distinct col_varchar_16 ) AS field2 , pk AS field3 FROM `t1` WHERE pk = 9 GROUP BY field1, field3 HAVING ((field3 = 6 OR field2 IS NULL XOR field1 > 2) AND field1 = 3 OR field2 IS NULL);

      【预期结果】
      正确返回结果

      【实际结果】
      MariaDB server core dump

      【备注】
      堆栈信息如下:
      230109 9:51:08 [ERROR] mysqld got signal 11 ;
      This could be because you hit a bug. It is also possible that this binary
      or one of the libraries it was linked against is corrupt, improperly built,
      or misconfigured. This error can also be caused by malfunctioning hardware.

      To report this bug, see https://mariadb.com/kb/en/reporting-bugs

      We will try our best to scrape up some info that will hopefully help
      diagnose the problem, but since we have already crashed,
      something is definitely wrong and this may fail.

      Server version: 10.5.15-MariaDB-debug
      key_buffer_size=134217728
      read_buffer_size=131072
      max_used_connections=1
      max_threads=153
      thread_count=1
      It is possible that mysqld could use up to
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467986 K bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.

      Thread pointer: 0x7f2fd8000b18
      Attempting backtrace. You can use the following information to find out
      where mysqld died. If you see no messages after this, something went
      terribly wrong...
      stack_bottom = 0x7f30542aae28 thread_stack 0x49000
      mysys/stacktrace.c:212(my_print_stacktrace)[0x563a733033a2]
      sql/signal_handler.cc:225(handle_fatal_signal)[0x563a729e2b24]
      ??:0(__restore_rt)[0x7f30577b4390]
      sql/item.cc:3453(Item_field::used_tables() const)[0x563a72a10d7f]
      sql/sql_select.cc:14303(update_depend_map_for_order(JOIN*, st_order*))[0x563a726e80a1]
      sql/sql_select.cc:14411(remove_const(JOIN*, st_order*, Item*, bool, bool*))[0x563a726e842d]
      sql/sql_select.cc:2333(JOIN::optimize_inner())[0x563a726c4147]
      sql/sql_select.cc:1712(JOIN::optimize())[0x563a726c1c75]
      sql/sql_select.cc:4824(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x563a726cd225]
      sql/sql_select.cc:457(handle_select(THD*, LEX*, select_result*, unsigned long))[0x563a726bc733]
      sql/sql_parse.cc:6314(execute_sqlcom_select(THD*, TABLE_LIST*))[0x563a7267e858]
      sql/sql_parse.cc:4005(mysql_execute_command(THD*))[0x563a72675a9d]
      sql/sql_parse.cc:8100(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x563a726836af]
      sql/sql_parse.cc:1894(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x563a7266f5d0]
      sql/sql_parse.cc:1371(do_command(THD*))[0x563a7266dc96]
      sql/sql_connect.cc:1418(do_handle_one_connection(CONNECT*, bool))[0x563a7281eedf]
      sql/sql_connect.cc:1314(handle_one_connection)[0x563a7281eb6a]

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              js niezhibiao
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.