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

Assertion `tbl->file->stats.records > null_count' failed in Ordered_key::Ordered_key on SELECT

    XMLWordPrintable

Details

    Description

      SET sql_mode='';
      CREATE TABLE t0 (a INT,b CHAR(0));
      INSERT INTO t0 VALUES (NULL,0),(NULL,0),(NULL,0),(NULL,0),(NULL,0),(NULL,0);
      SET @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_ROWID_merge=on,partial_match_table_scan=off';
      SET SESSION max_heap_table_size=0;
      SELECT ROW(0,0) IN (SELECT t0.a,0 FROM t0) FROM t0;
      

      Leads to:

      10.10.0 63961a08a6203f4d58363a9321e4cf9c8b07a9fe (Debug)

      mysqld: /test/10.10_dbg/sql/item_subselect.cc:5915: Ordered_key::Ordered_key(uint, TABLE*, Item*, ha_rows, ha_rows, ha_rows, uchar*): Assertion `tbl->file->stats.records > null_count' failed.
      

      10.10.0 63961a08a6203f4d58363a9321e4cf9c8b07a9fe (Debug)

      Core was generated by `/test/MD290622-mariadb-10.10.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x148ead9c5700 (LWP 3578482))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x0000148ec6332859 in __GI_abort () at abort.c:79
      #2  0x0000148ec6332729 in __assert_fail_base (fmt=0x148ec64c8588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5644b8344ee8 "tbl->file->stats.records > null_count", file=0x5644b8343778 "/test/10.10_dbg/sql/item_subselect.cc", line=5915, function=<optimized out>) at assert.c:92
      #3  0x0000148ec6343fd6 in __GI___assert_fail (assertion=assertion@entry=0x5644b8344ee8 "tbl->file->stats.records > null_count", file=file@entry=0x5644b8343778 "/test/10.10_dbg/sql/item_subselect.cc", line=line@entry=5915, function=function@entry=0x5644b8344f10 "Ordered_key::Ordered_key(uint, TABLE*, Item*, ha_rows, ha_rows, ha_rows, uchar*)") at assert.c:101
      #4  0x00005644b79bbf7a in Ordered_key::Ordered_key (this=0x148e7807bea8, keyid_arg=<optimized out>, tbl_arg=<optimized out>, search_key_arg=<optimized out>, null_count_arg=<optimized out>, min_null_row_arg=1, max_null_row_arg=2, row_num_to_rowid_arg=0x148e7801c808 "\245\245\245\245\245\245\245\245h4z\025") at /test/10.10_dbg/sql/item_subselect.cc:5915
      #5  0x00005644b79bd8b1 in subselect_rowid_merge_engine::init (this=this@entry=0x148e7807b9d8, non_null_key_parts=non_null_key_parts@entry=0x148e780749b0, partial_match_key_parts=partial_match_key_parts@entry=0x148e780749c8) at /test/10.10_dbg/sql/sql_class.h:6721
      #6  0x00005644b79bf1ca in subselect_hash_sj_engine::exec (this=0x148e78074948) at /test/10.10_dbg/sql/item_subselect.cc:5834
      #7  0x00005644b79af8fc in Item_subselect::exec (this=this@entry=0x148e780158c8) at /test/10.10_dbg/sql/item_subselect.cc:854
      #8  0x00005644b79b4bc9 in Item_in_subselect::exec (this=0x148e780158c8) at /test/10.10_dbg/sql/item_subselect.cc:1036
      #9  0x00005644b79aeaa3 in Item_in_subselect::val_bool (this=0x148e780158c8) at /test/10.10_dbg/sql/item_subselect.cc:1989
      #10 0x00005644b748ef01 in Item::val_bool_result (this=<optimized out>) at /test/10.10_dbg/sql/item.h:1783
      #11 0x00005644b78f7cde in Item_in_optimizer::val_int (this=0x148e78017a80) at /test/10.10_dbg/sql/item_cmpfunc.cc:1637
      #12 0x00005644b748eec5 in Item::val_int_result (this=<optimized out>) at /test/10.10_dbg/sql/item.h:1779
      #13 0x00005644b78babe1 in Item_cache_int::cache_value (this=0x148e7807ad60) at /test/10.10_dbg/sql/item.cc:10125
      #14 0x00005644b78d81b2 in Item_cache_wrapper::cache (this=0x148e7807acc0) at /test/10.10_dbg/sql/item.cc:8881
      #15 Item_cache_wrapper::val_int (this=0x148e7807acc0) at /test/10.10_dbg/sql/item.cc:8935
      #16 0x00005644b77cd849 in Type_handler::Item_send_long (this=<optimized out>, item=0x148e7807acc0, protocol=0x148e780013c0, buf=<optimized out>) at /test/10.10_dbg/sql/sql_type.cc:7496
      #17 0x00005644b77d676f in Type_handler_long::Item_send (this=<optimized out>, item=<optimized out>, protocol=<optimized out>, buf=<optimized out>) at /test/10.10_dbg/sql/sql_type.h:5687
      #18 0x00005644b78ba58d in Item::send (buffer=0x148ead9c30b0, protocol=0x148e780013c0, this=0x148e7807acc0) at /test/10.10_dbg/sql/item.h:1227
      #19 Item_cache_wrapper::send (this=0x148e7807acc0, protocol=0x148e780013c0, buffer=0x148ead9c30b0) at /test/10.10_dbg/sql/item.cc:8787
      #20 0x00005644b74c5ab9 in Protocol::send_result_set_row (this=this@entry=0x148e780013c0, row_items=row_items@entry=0x148e78013f88) at /test/10.10_dbg/sql/protocol.cc:1328
      #21 0x00005644b75535f3 in select_send::send_data (this=0x148e78016c68, items=@0x148e78013f88: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x148e78015bd8, last = 0x148e78015bd8, elements = 1}, <No data fields>}) at /test/10.10_dbg/sql/sql_class.cc:3101
      #22 0x00005644b762d991 in select_result_sink::send_data_with_check (sent=<optimized out>, u=<optimized out>, items=@0x148e78013f88: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x148e78015bd8, last = 0x148e78015bd8, elements = 1}, <No data fields>}, this=<optimized out>) at /test/10.10_dbg/sql/sql_class.h:5697
      #23 end_send (join=0x148e78016c90, join_tab=0x148e7807a560, end_of_records=<optimized out>) at /test/10.10_dbg/sql/sql_select.cc:22514
      #24 0x00005644b75ff6e7 in evaluate_join_record (join=join@entry=0x148e78016c90, join_tab=join_tab@entry=0x148e7807a1b0, error=error@entry=0) at /test/10.10_dbg/sql/sql_select.cc:21508
      #25 0x00005644b7615345 in sub_select (join=0x148e78016c90, join_tab=0x148e7807a1b0, end_of_records=false) at /test/10.10_dbg/sql/sql_select.cc:21278
      #26 0x00005644b7648c43 in do_select (procedure=<optimized out>, join=0x148e78016c90) at /test/10.10_dbg/sql/sql_select.cc:20823
      #27 JOIN::exec_inner (this=this@entry=0x148e78016c90) at /test/10.10_dbg/sql/sql_select.cc:4787
      #28 0x00005644b76491dc in JOIN::exec (this=this@entry=0x148e78016c90) at /test/10.10_dbg/sql/sql_select.cc:4565
      #29 0x00005644b7646f60 in mysql_select (thd=thd@entry=0x148e78000db8, tables=0x148e78015c90, fields=@0x148e78013f88: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x148e78015bd8, last = 0x148e78015bd8, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x148e78016c68, unit=0x148e78004fd8, select_lex=0x148e78013ce8) at /test/10.10_dbg/sql/sql_select.cc:5045
      #30 0x00005644b7647756 in handle_select (thd=thd@entry=0x148e78000db8, lex=lex@entry=0x148e78004f00, result=result@entry=0x148e78016c68, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.10_dbg/sql/sql_select.cc:579
      #31 0x00005644b75b3096 in execute_sqlcom_select (thd=thd@entry=0x148e78000db8, all_tables=0x148e78015c90) at /test/10.10_dbg/sql/sql_parse.cc:6260
      #32 0x00005644b75bf3a8 in mysql_execute_command (thd=thd@entry=0x148e78000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.10_dbg/sql/sql_parse.cc:3944
      #33 0x00005644b75ad372 in mysql_parse (thd=thd@entry=0x148e78000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x148ead9c4470) at /test/10.10_dbg/sql/sql_parse.cc:8036
      #34 0x00005644b75ba95a in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x148e78000db8, packet=packet@entry=0x148e7800b6c9 "", packet_length=packet_length@entry=50, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_class.h:1364
      #35 0x00005644b75bd064 in do_command (thd=0x148e78000db8, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_parse.cc:1407
      #36 0x00005644b771cfde in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5644b993c918, put_in_cache=put_in_cache@entry=true) at /test/10.10_dbg/sql/sql_connect.cc:1418
      #37 0x00005644b771d4e7 in handle_one_connection (arg=0x5644b993c918) at /test/10.10_dbg/sql/sql_connect.cc:1312
      #38 0x0000148ec6843609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #39 0x0000148ec642f133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.5.17 (dbg), 10.6.9 (dbg), 10.7.5 (dbg), 10.8.4 (dbg), 10.9.2 (dbg), 10.10.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.3.36 (dbg), 10.3.36 (opt), 10.4.26 (dbg), 10.4.26 (opt), 10.5.17 (opt), 10.6.9 (opt), 10.7.5 (opt), 10.8.4 (opt), 10.9.2 (opt), 10.10.0 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.38 (dbg), 5.7.38 (opt), 8.0.29 (dbg), 8.0.29 (opt)

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.