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

Assertion `a == &type_handler_row || a == &type_handler_null' failed on CREATE TABLE ... ROW()

    XMLWordPrintable

Details

    Description

      There are similar bugs around like MDEV-36964 and MDEV-36792. This is however a new 12.1 regression.

      CREATE TABLE t (c INT, CHECK(c=CASE c WHEN ROW(1,1) THEN c=0 END IN (c)=1));
      

      Leads to:

      CS 12.1.2 033471a367b4c60b7262e64f43f46b02e95b9d74 (Debug, Clang 18.1.3-1) Build 08/08/2025

      mariadbd: /test/12.1_dbg/sql/sql_type_row.cc:49: virtual const Type_handler *Type_collection_row::aggregate_for_comparison(const Type_handler *, const Type_handler *) const: Assertion `a == &type_handler_row || a == &type_handler_null' failed.
      

      CS 12.1.2 033471a367b4c60b7262e64f43f46b02e95b9d74 (Debug, Clang 18.1.3-1) Build 08/08/2025

      Core was generated by `/test/MD080825-mariadb-12.1.2-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 853156)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x0000762a5da4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000762a5da288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000762a5da2881b in __assert_fail_base (fmt=0x762a5dbd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x6122b2ff29e7 "a == &type_handler_row || a == &type_handler_null", file=file@entry=0x6122b30fc486 "/test/12.1_dbg/sql/sql_type_row.cc", line=line@entry=49, function=function@entry=0x6122b3038755 "virtual const Type_handler *Type_collection_row::aggregate_for_comparison(const Type_handler *, const Type_handler *) const") at ./assert/assert.c:94
      #6  0x0000762a5da3b507 in __assert_fail (assertion=0x6122b2ff29e7 "a == &type_handler_row || a == &type_handler_null", file=0x6122b30fc486 "/test/12.1_dbg/sql/sql_type_row.cc", line=49, function=0x6122b3038755 "virtual const Type_handler *Type_collection_row::aggregate_for_comparison(const Type_handler *, const Type_handler *) const")at ./assert/assert.c:103
      #7  0x00006122b404b73f in Type_collection_row::aggregate_for_comparison (this=0x6122b4c20558 <type_collection_row>, a=0x6122b4e74ec8 <type_handler_slonglong>, b=0x6122b4e76388 <type_handler_row_internal>)at /test/12.1_dbg/sql/sql_type_row.cc:49
      #8  0x00006122b3fc841e in Type_handler_hybrid_field_type::aggregate_for_comparison (this=0x762a5c1c6490, h=0x6122b4e76388 <type_handler_row_internal>)at /test/12.1_dbg/sql/sql_type.cc:1924
      #9  0x00006122b392db7c in Type_handler_hybrid_field_type::aggregate_for_comparison (this=0x762a5c1c6490, funcname=@0x6122b4bfd860: {str = 0x6122b2ffb5fd "case..when", length = 10}, items=0x762a5c1c6480, nitems=2, int_uint_as_dec=true)at /test/12.1_dbg/sql/item_cmpfunc.cc:107
      #10 0x00006122b393a613 in Predicant_to_list_comparator::add_value (this=0x76294c02b618, funcname=@0x6122b4bfd860: {str = 0x6122b2ffb5fd "case..when", length = 10}, args=0x76294c02b598, value_index=1) at /test/12.1_dbg/sql/item_cmpfunc.cc:4164
      #11 0x00006122b393a785 in Predicant_to_list_comparator::add_value_skip_null (this=0x76294c02b618, funcname=@0x6122b4bfd860: {str = 0x6122b2ffb5fd "case..when", length = 10}, args=0x76294c02b598, value_index=1, nulls_found=0x762a5c1c653e)at /test/12.1_dbg/sql/item_cmpfunc.cc:4193
      #12 0x00006122b393a3f4 in Item_func_case_simple::prepare_predicant_and_values (this=0x76294c02b518, thd=0x76294c000d58, found_types=0x76294c02b628, nulls_equal=false) at /test/12.1_dbg/sql/item_cmpfunc.cc:3353
      #13 0x00006122b393a970 in Item_func_case_simple::aggregate_switch_and_when_arguments (this=0x76294c02b518, thd=0x76294c000d58, nulls_eq=false)at /test/12.1_dbg/sql/item_cmpfunc.cc:3413
      #14 0x00006122b393a906 in Item_func_case_simple::fix_length_and_dec (this=0x76294c02b518, thd=0x76294c000d58)at /test/12.1_dbg/sql/item_cmpfunc.cc:3373
      #15 0x00006122b38aa8aa in Item_func::fix_fields (this=0x76294c02b518, thd=0x76294c000d58, ref=0x76294c02b868)at /test/12.1_dbg/sql/item_func.cc:412
      #16 0x00006122b393a2c9 in Item_func_case::fix_fields (this=0x76294c02b518, thd=0x76294c000d58, ref=0x76294c02b868)at /test/12.1_dbg/sql/item_cmpfunc.cc:3315
      #17 0x00006122b38938aa in Item::fix_fields_if_needed (this=0x76294c02b518, thd=0x76294c000d58, ref=0x76294c02b868) at /test/12.1_dbg/sql/item.h:1143
      #18 0x00006122b38aa782 in Item_func::fix_fields (this=0x76294c02b7e0, thd=0x76294c000d58, ref=0x76294c02bb50)at /test/12.1_dbg/sql/item_func.cc:394
      #19 0x00006122b38938aa in Item::fix_fields_if_needed (this=0x76294c02b7e0, thd=0x76294c000d58, ref=0x76294c02bb50) at /test/12.1_dbg/sql/item.h:1143
      #20 0x00006122b38aa782 in Item_func::fix_fields (this=0x76294c02bac0, thd=0x76294c000d58, ref=0x76294c02be08)at /test/12.1_dbg/sql/item_func.cc:394
      #21 0x00006122b38938aa in Item::fix_fields_if_needed (this=0x76294c02bac0, thd=0x76294c000d58, ref=0x76294c02be08) at /test/12.1_dbg/sql/item.h:1143
      #22 0x00006122b38aa782 in Item_func::fix_fields (this=0x76294c02bd80, thd=0x76294c000d58, ref=0x76294c02ba30)at /test/12.1_dbg/sql/item_func.cc:394
      #23 0x00006122b3e4c1e7 in Virtual_column_info::fix_expr (this=0x76294c02ba20, thd=0x76294c000d58) at /test/12.1_dbg/sql/table.cc:3818
      #24 0x00006122b3e49132 in Virtual_column_info::fix_and_check_expr (this=0x76294c02ba20, thd=0x76294c000d58, table=0x762a5c1c9e08)at /test/12.1_dbg/sql/table.cc:4020
      #25 0x00006122b3e48e42 in unpack_vcol_info_from_frm (thd=0x76294c000d58, table=0x762a5c1c9e08, expr_str=0x762a5c1c9610, vcol_ptr=0x76294c02a448, error_reported=0x762a5c1c9a87) at /test/12.1_dbg/sql/table.cc:4157
      #26 0x00006122b3e47c76 in parse_vcol_defs (thd=0x76294c000d58, mem_root=0x762a5c1ca100, table=0x762a5c1c9e08, error_reported=0x762a5c1c9a87, mode=VCOL_INIT_DEPENDENCY_FAILURE_IS_ERROR)at /test/12.1_dbg/sql/table.cc:1307
      #27 0x00006122b3e4dbd4 in open_table_from_share (thd=0x76294c000d58, share=0x762a5c1cb1a0, alias=0x6122b4b59c40 <empty_clex_str>, db_stat=0, prgflag=1, ha_open_flags=0, outparam=0x762a5c1c9e08, is_create_table=true, partitions_to_open=0x0) at /test/12.1_dbg/sql/table.cc:4573
      #28 0x00006122b380f4b9 in ha_create_table_from_share (thd=0x76294c000d58, share=0x762a5c1cb1a0, create_info=0x762a5c1ccfa8, ref_length=0x762a5c1ca2f4) at /test/12.1_dbg/sql/handler.cc:6418
      #29 0x00006122b380ee6d in ha_create_table (thd=0x76294c000d58, path=0x762a5c1cc880 "./test/t", db=0x76294c01a168 "test", table_name=0x76294c01a138 "t", create_info=0x762a5c1ccfa8, frm=0x762a5c1cc810, skip_frm_file=false)at /test/12.1_dbg/sql/handler.cc:6494
      #30 0x00006122b3de3c83 in create_table_impl (thd=0x76294c000d58, ddl_log_state_create=0x762a5c1ccbe8, ddl_log_state_rm=0x762a5c1ccbc8, orig_db=@0x76294c01a190: {<Lex_ident_fs> = {<Lex_ident<Compare_table_names>> = {<Lex_cstring> = {<st_mysql_const_lex_string> = {str = 0x76294c01a168 "test", length = 4}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, orig_table_name=@0x76294c01a1a0: {<Lex_ident_fs> = {<Lex_ident<Compare_table_names>> = {<Lex_cstring> = {<st_mysql_const_lex_string> = {str = 0x76294c01a138 "t", length = 1}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, db=@0x76294c01a190: {str = 0x76294c01a168 "test", length = 4}, table_name=@0x76294c01a1a0: {str = 0x76294c01a138 "t", length = 1}, path=@0x762a5c1cc7f8: {str = 0x762a5c1cc880 "./test/t", length = 8}, options={m_options = DDL_options_st::OPT_NONE}, create_info=0x762a5c1ccfa8, alter_info=0x762a5c1cce30, create_table_mode=0, is_trans=0x762a5c1ccbbf, key_info=0x762a5c1cc840, key_count=0x762a5c1cc83c, frm=0x762a5c1cc810)at /test/12.1_dbg/sql/sql_table.cc:4950
      #31 0x00006122b3de2d28 in mysql_create_table_no_lock (thd=0x76294c000d58, ddl_log_state_create=0x762a5c1ccbe8, ddl_log_state_rm=0x762a5c1ccbc8, create_info=0x762a5c1ccfa8, alter_info=0x762a5c1cce30, is_trans=0x762a5c1ccbbf, create_table_mode=0, table_list=0x76294c01a178)at /test/12.1_dbg/sql/sql_table.cc:5052
      #32 0x00006122b3dff26b in mysql_create_table (thd=0x76294c000d58, create_table=0x76294c01a178, create_info=0x762a5c1ccfa8, alter_info=0x762a5c1cce30) at /test/12.1_dbg/sql/sql_table.cc:5294
      #33 0x00006122b3dfd7a5 in Sql_cmd_create_table_like::execute (this=0x76294c01a100, thd=0x76294c000d58)at /test/12.1_dbg/sql/sql_table.cc:13781
      #34 0x00006122b3caf1cd in mysql_execute_command (thd=0x76294c000d58, is_called_from_prepared_stmt=false) at /test/12.1_dbg/sql/sql_parse.cc:5857
      #35 0x00006122b3c9e524 in mysql_parse (thd=0x76294c000d58, rawbuf=0x76294c01a008 "CREATE TABLE t (c INT, CHECK(c=CASE c WHEN ROW(1,1) THEN c=0 END IN (c)=1))", length=75, parser_state=0x762a5c1cea10)at /test/12.1_dbg/sql/sql_parse.cc:7883
      #36 0x00006122b3c9b8f8 in dispatch_command (command=COM_QUERY, thd=0x76294c000d58, packet=0x76294c00b1f9 "CREATE TABLE t (c INT, CHECK(c=CASE c WHEN ROW(1,1) THEN c=0 END IN (c)=1))", packet_length=75, blocking=true)at /test/12.1_dbg/sql/sql_parse.cc:1878
      #37 0x00006122b3c9f0d3 in do_command (thd=0x76294c000d58, blocking=true)at /test/12.1_dbg/sql/sql_parse.cc:1417
      #38 0x00006122b3ebe139 in do_handle_one_connection (connect=0x6122b7292f38, put_in_cache=true) at /test/12.1_dbg/sql/sql_connect.cc:1414
      #39 0x00006122b3ebdede in handle_one_connection (arg=0x6122b71c72f8)at /test/12.1_dbg/sql/sql_connect.cc:1326
      #40 0x0000762a5da9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #41 0x0000762a5db29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.6   dbg  080825  13f337ce1f295f4aac75db681e00c71f2bf8acaf  No bug found                  
      CS  10.6   opt  080825  13f337ce1f295f4aac75db681e00c71f2bf8acaf  No bug found                  
      CS  10.11  dbg  080825  c45a34b2fb10e4e8f768e7e5fe846e9592eb6ea8  No bug found                  
      CS  10.11  opt  080825  c45a34b2fb10e4e8f768e7e5fe846e9592eb6ea8  No bug found                  
      CS  11.4   dbg  080825  03b31c0bd99390c1984f19a19f22dd6e77b7692e  No bug found                  
      CS  11.4   opt  080825  03b31c0bd99390c1984f19a19f22dd6e77b7692e  No bug found                  
      CS  11.8   dbg  080825  1a446ccc48528e88a3cd6cd1d1ec9e7492d342ca  No bug found                  
      CS  11.8   opt  080825  1a446ccc48528e88a3cd6cd1d1ec9e7492d342ca  No bug found                  
      CS  12.1   dbg  080825  033471a367b4c60b7262e64f43f46b02e95b9d74  a == &type_handler_row || a == &type_handler_null|SIGABRT|Type_collection_row::aggregate_for_comparison|Type_handler_hybrid_field_type::aggregate_for_comparison|Type_handler_hybrid_field_type::aggregate_for_comparison|Predicant_to_list_comparator::add_value
      CS  12.1   opt  080825  033471a367b4c60b7262e64f43f46b02e95b9d74  No bug found                  
      CS  12.2   dbg  080825  e02f4d7e311e214ea62ff2e59599849e229f4165  a == &type_handler_row || a == &type_handler_null|SIGABRT|Type_collection_row::aggregate_for_comparison|Type_handler_hybrid_field_type::aggregate_for_comparison|Type_handler_hybrid_field_type::aggregate_for_comparison|Predicant_to_list_comparator::add_value
      CS  12.2   opt  080825  e02f4d7e311e214ea62ff2e59599849e229f4165  No bug found                  
      ES  10.5   dbg  080825  70586522eacf09d04d49962072e14325a75d8155  No bug found                  
      ES  10.5   opt  080825  70586522eacf09d04d49962072e14325a75d8155  No bug found                  
      ES  10.6   dbg  080825  9b794f34b48fb7eee490b6da44edc0f33a947447  No bug found                  
      ES  10.6   opt  080825  9b794f34b48fb7eee490b6da44edc0f33a947447  No bug found                  
      ES  11.4   dbg  080825  a1c03ccd54b582e75506687ee19b273ca897f261  No bug found                  
      ES  11.4   opt  080825  a1c03ccd54b582e75506687ee19b273ca897f261  No bug found                  
      ES  11.8   dbg  080825  4cdf75ab6ba37d4e7e208690785e880ed3176f2f  No bug found                  
      ES  11.8   opt  080825  4cdf75ab6ba37d4e7e208690785e880ed3176f2f  No bug found                  
      MS  5.5    dbg  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.5    opt  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.6    dbg  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.6    opt  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.7    dbg  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  5.7    opt  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  8.0    dbg  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  8.0    opt  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  9.1    dbg  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      MS  9.1    opt  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      

      No UBSAN/ASAN issues observed. On 11.8 we see instead:

      CS 11.8.4 1a446ccc48528e88a3cd6cd1d1ec9e7492d342ca (Debug, Clang 18.1.3-1) Build 08/08/2025

      11.8.4-dbg>CREATE TABLE t (c INT, CHECK(c=CASE c WHEN ROW(1,1) THEN c=0 END IN (c)=1));
      ERROR 1241 (21000): Operand should contain 1 column(s)
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              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.