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

Wrong result or Assertion `0' failed in Item::val_native upon query with TIMESTAMP field, NULLIF and ROLLUP

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.7.0, 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 10.11, 11.1(EOL), 11.2(EOL), 11.4, 11.5(EOL), 11.6(EOL)
    • 10.5, 10.6, 10.11, 11.4
    • Temporal Types
    • None

    Description

      CREATE TABLE t1 (s TIMESTAMP);
      INSERT INTO t1 VALUES ('2033-06-06'),('2015-09-10');
      SELECT NULLIF( s, NULL ) AS f FROM t1 GROUP BY s WITH ROLLUP;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 non-debug bf2a2444

      SELECT NULLIF( s, NULL ) AS f FROM t1 GROUP BY s WITH ROLLUP;
      f
      2033-06-06 00:00:00
      2033-06-06 00:00:00
      NULL
      

      The expected result is

      10.3

      SELECT NULLIF( s, NULL ) AS f FROM t1 GROUP BY s WITH ROLLUP;
      f
      2015-09-10 00:00:00
      2033-06-06 00:00:00
      NULL
      

      10.4 debug bf2a2444

      mysqld: /data/src/10.4/sql/item.h:1344: virtual bool Item::val_native(THD*, Native*): Assertion `0' failed.
      200613 17:07:15 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f158b3e1f12 in __GI___assert_fail (assertion=0x560fb2c5a400 "0", file=0x560fb2c5a3d3 "/data/src/10.4/sql/item.h", line=1344, function=0x560fb2c5a940 <Item::val_native(THD*, Native*)::__PRETTY_FUNCTION__> "virtual bool Item::val_native(THD*, Native*)") at assert.c:101
      #8  0x0000560fb1e6e770 in Item::val_native (this=0x7f1574017150, thd=0x7f1574000af0, to=0x7f1585589da0) at /data/src/10.4/sql/item.h:1344
      #9  0x0000560fb2027fcf in Item::val_native_from_item (this=0x7f1574015658, thd=0x7f1574000af0, item=0x7f1574017150, to=0x7f1585589da0) at /data/src/10.4/sql/item.h:867
      #10 0x0000560fb231ccec in Item_ref::val_native (this=0x7f1574015658, thd=0x7f1574000af0, to=0x7f1585589da0) at /data/src/10.4/sql/item.cc:8268
      #11 0x0000560fb21b9b49 in Type_handler_timestamp_common::Item_val_native_with_conversion (this=0x560fb375ac00 <type_handler_timestamp2>, thd=0x7f1574000af0, item=0x7f1574015658, to=0x7f1585589da0) at /data/src/10.4/sql/sql_type.cc:8261
      #12 0x0000560fb2257390 in Item::val_native_with_conversion (this=0x7f1574015658, thd=0x7f1574000af0, to=0x7f1585589da0, th=0x560fb375ac00 <type_handler_timestamp2>) at /data/src/10.4/sql/item.h:1302
      #13 0x0000560fb2257342 in Item::val_native_with_conversion_from_item (this=0x7f15740138d0, thd=0x7f1574000af0, item=0x7f1574015658, to=0x7f1585589da0, handler=0x560fb375ac00 <type_handler_timestamp2>) at /data/src/10.4/sql/item.h:881
      #14 0x0000560fb2337da6 in Item_func_nullif::native_op (this=0x7f15740138d0, thd=0x7f1574000af0, to=0x7f1585589da0) at /data/src/10.4/sql/item_cmpfunc.cc:2934
      #15 0x0000560fb1f7515f in Item_func_hybrid_field_type::val_native (this=0x7f15740138d0, thd=0x7f1574000af0, to=0x7f1585589da0) at /data/src/10.4/sql/item_func.h:783
      #16 0x0000560fb21b9f32 in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (this=0x7f1585589da0, thd=0x7f1574000af0, item=0x7f15740138d0, conv=false) at /data/src/10.4/sql/sql_type.cc:8305
      #17 0x0000560fb21be70b in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (this=0x7f1585589da0, thd=0x7f1574000af0, item=0x7f15740138d0) at /data/src/10.4/sql/sql_type.h:2521
      #18 0x0000560fb21b474b in Type_handler::Item_send_timestamp (this=0x560fb375ac00 <type_handler_timestamp2>, item=0x7f15740138d0, protocol=0x7f15740010b8, buf=0x7f1585589eb0) at /data/src/10.4/sql/sql_type.cc:6832
      #19 0x0000560fb21c20fc in Type_handler_timestamp_common::Item_send (this=0x560fb375ac00 <type_handler_timestamp2>, item=0x7f15740138d0, protocol=0x7f15740010b8, buf=0x7f1585589eb0) at /data/src/10.4/sql/sql_type.h:5656
      #20 0x0000560fb1e6e4ec in Item::send (this=0x7f15740138d0, protocol=0x7f15740010b8, buffer=0x7f1585589eb0) at /data/src/10.4/sql/item.h:1038
      #21 0x0000560fb1e68637 in Protocol::send_result_set_row (this=0x7f15740010b8, row_items=0x7f15740154a0) at /data/src/10.4/sql/protocol.cc:1035
      #22 0x0000560fb1f1d2a2 in select_send::send_data (this=0x7f1574014cc0, items=...) at /data/src/10.4/sql/sql_class.cc:2998
      #23 0x0000560fb201d7c1 in JOIN::rollup_send_data (this=0x7f1574014ce8, idx=0) at /data/src/10.4/sql/sql_select.cc:25938
      #24 0x0000560fb2012937 in end_send_group (join=0x7f1574014ce8, join_tab=0x7f1574016718, end_of_records=true) at /data/src/10.4/sql/sql_select.cc:21730
      #25 0x0000560fb200ee31 in sub_select (join=0x7f1574014ce8, join_tab=0x7f1574016370, end_of_records=true) at /data/src/10.4/sql/sql_select.cc:20329
      #26 0x0000560fb200e55a in do_select (join=0x7f1574014ce8, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19920
      #27 0x0000560fb1fe33bd in JOIN::exec_inner (this=0x7f1574014ce8) at /data/src/10.4/sql/sql_select.cc:4470
      #28 0x0000560fb1fe24fa in JOIN::exec (this=0x7f1574014ce8) at /data/src/10.4/sql/sql_select.cc:4252
      #29 0x0000560fb1fe3c0f in mysql_select (thd=0x7f1574000af0, tables=0x7f1574013b90, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f1574014380, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f1574014cc0, unit=0x7f1574004a18, select_lex=0x7f1574013278) at /data/src/10.4/sql/sql_select.cc:4684
      #30 0x0000560fb1fd36f2 in handle_select (thd=0x7f1574000af0, lex=0x7f1574004958, result=0x7f1574014cc0, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:422
      #31 0x0000560fb1f9a21c in execute_sqlcom_select (thd=0x7f1574000af0, all_tables=0x7f1574013b90) at /data/src/10.4/sql/sql_parse.cc:6360
      #32 0x0000560fb1f908a9 in mysql_execute_command (thd=0x7f1574000af0) at /data/src/10.4/sql/sql_parse.cc:3898
      #33 0x0000560fb1f9e1c9 in mysql_parse (thd=0x7f1574000af0, rawbuf=0x7f1574013198 "SELECT  NULLIF( s, NULL ) AS f FROM t1 GROUP BY s WITH ROLLUP", length=61, parser_state=0x7f158558b570, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
      #34 0x0000560fb1f8a753 in dispatch_command (command=COM_QUERY, thd=0x7f1574000af0, packet=0x7f15740083a1 "", packet_length=61, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #35 0x0000560fb1f88ef5 in do_command (thd=0x7f1574000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #36 0x0000560fb2111aa8 in do_handle_one_connection (connect=0x560fb496cce0) at /data/src/10.4/sql/sql_connect.cc:1412
      #37 0x0000560fb21117f7 in handle_one_connection (arg=0x560fb496cce0) at /data/src/10.4/sql/sql_connect.cc:1316
      #38 0x0000560fb2b0fda1 in pfs_spawn_thread (arg=0x560fb4988900) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #39 0x00007f158d36a4a4 in start_thread (arg=0x7f158558c700) at pthread_create.c:456
      #40 0x00007f158b49ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible with at least InnoDB, MyISAM, Aria.
      The assertion failure appeared in 10.4 branch after this commit:

      commit ea7830eef48333e28f98a9b91f05a95735b465a3
      Author: Alexander Barkov
      Date:   Fri May 22 16:31:16 2020 +0400
       
          MDEV-14221 Assertion `0' failed in Item::field_type_for_temporal_comparison
      

      However the wrong result was there before.

      Attachments

        Issue Links

          Activity

            Roel Roel Van de Paar added a comment - - edited

            SET SQL_MODE='';
            CREATE TABLE t (a TIMESTAMP, b DATETIME, c TIME) ENGINE=InnoDB;
            INSERT INTO t VALUES (NULL,NULL,NULL);
            SELECT CASE a WHEN a THEN a END FROM t GROUP BY a WITH ROLLUP;
            

            Leads to:

            10.5.4 4080e3acefd7e58d88c2f3539fb6a0fb359cf057

            mysqld: /test/10.5_dbg/sql/item.h:1362: virtual bool Item::val_native(THD*, Native*): Assertion `0' failed.
            

            10.5.4 4080e3acefd7e58d88c2f3539fb6a0fb359cf057

            Core was generated by `/test/MD150620-mariadb-10.5.4-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
            Program terminated with signal SIGABRT, Aborted.
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
                at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
            [Current thread is 1 (Thread 0x15169a50c700 (LWP 3214203))]
            (gdb) bt
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
            #1  0x00005627771a64c6 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
            #2  0x0000562776948d60 in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
            #3  <signal handler called>
            #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
            #5  0x00001516a2848801 in __GI_abort () at abort.c:79
            #6  0x00001516a283839a in __assert_fail_base (fmt=0x1516a29bf7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5627774e056f "0", file=file@entry=0x5627772fe974 "/test/10.5_dbg/sql/item.h", line=line@entry=1362, function=function@entry=0x5627772feda0 <Item::val_native(THD*, Native*)::__PRETTY_FUNCTION__> "virtual bool Item::val_native(THD*, Native*)") at assert.c:92
            #7  0x00001516a2838412 in __GI___assert_fail (assertion=assertion@entry=0x5627774e056f "0", file=file@entry=0x5627772fe974 "/test/10.5_dbg/sql/item.h", line=line@entry=1362, function=function@entry=0x5627772feda0 <Item::val_native(THD*, Native*)::__PRETTY_FUNCTION__> "virtual bool Item::val_native(THD*, Native*)") at assert.c:101
            #8  0x00005627765b1405 in Item::val_native (this=0x15167f0783d0, thd=<optimized out>, to=<optimized out>) at /test/10.5_dbg/sql/item.h:1362
            #9  0x000056277698b308 in Item::val_native_from_item (this=0x15167f076620, thd=0x15167f015088, item=0x15167f0783d0, to=0x15167f076508) at /test/10.5_dbg/sql/item.h:879
            #10 0x000056277696face in Item_ref::val_native (this=<optimized out>, thd=<optimized out>, to=<optimized out>) at /test/10.5_dbg/sql/item.cc:8332
            #11 0x0000562776885bd7 in Type_handler_timestamp_common::Item_val_native_with_conversion (this=0x562777f28b00 <type_handler_timestamp2>, thd=0x15167f015088, item=0x15167f076620, to=0x15167f076508) at /test/10.5_dbg/sql/sql_type.cc:8684
            #12 0x000056277699418b in Item::val_native_with_conversion (th=<optimized out>, to=0x15167f076508, thd=<optimized out>, this=0x15167f076620) at /test/10.5_dbg/sql/item.h:1320
            #13 cmp_item_timestamp::store_value (this=0x15167f0764f0, item=0x15167f076620) at /test/10.5_dbg/sql/item_cmpfunc.cc:4246
            #14 0x0000562776995a67 in Predicant_to_list_comparator::cmp_arg (i=0, args=0x15167f074aa0, this=0x15167f074b10) at /test/10.5_dbg/sql/item_cmpfunc.h:1936
            #15 Predicant_to_list_comparator::cmp (found_unknown_values=0x0, idx=<synthetic pointer>, args=0x15167f074aa0, this=0x15167f074b10) at /test/10.5_dbg/sql/item_cmpfunc.h:2126
            #16 Item_func_case_simple::find_item (this=0x15167f074a10) at /test/10.5_dbg/sql/item_cmpfunc.cc:3026
            #17 0x0000562776998985 in Item_func_case::native_op (this=0x15167f074a10, thd=0x15167f015088, to=0x15169a509e60) at /test/10.5_dbg/sql/item_cmpfunc.cc:3136
            #18 0x00005627769a61c5 in Item_func_hybrid_field_type::val_native (this=0x15167f074a10, thd=0x15167f015088, to=0x15169a509e60) at /test/10.5_dbg/sql/item_func.h:907
            #19 0x0000562776885de1 in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (this=0x15169a509e60, thd=0x15167f015088, item=0x15167f074a10, conv=<optimized out>) at /test/10.5_dbg/sql/sql_type.cc:8728
            #20 0x0000562776886622 in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (item=0x15167f074a10, thd=<optimized out>, this=0x15169a509e60) at /test/10.5_dbg/sql/sql_type.h:2666
            #21 Type_handler::Item_send_timestamp (this=<optimized out>, item=0x15167f074a10, protocol=0x15167f015650, buf=0x15169a509f40) at /test/10.5_dbg/sql/sql_type.cc:7210
            #22 0x00005627767d9da3 in Type_handler_timestamp_common::Item_send (this=<optimized out>, item=<optimized out>, protocol=<optimized out>, buf=<optimized out>) at /test/10.5_dbg/sql/sql_type.h:6351
            #23 0x00005627765b07a9 in Item::send (this=0x15167f074a10, protocol=0x15167f015650, buffer=0x15169a509f40) at /test/10.5_dbg/sql/item.h:1056
            #24 0x00005627765ae519 in Protocol::send_result_set_row (this=this@entry=0x15167f015650, row_items=row_items@entry=0x15167f076560) at /test/10.5_dbg/sql/protocol.cc:1082
            #25 0x000056277664013a in select_send::send_data (this=0x15167f075d78, items=@0x15167f076560: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x15167f076610, last = 0x15167f076610, elements = 1}, <No data fields>}) at /test/10.5_dbg/sql/sql_class.cc:3004
            #26 0x00005627766f78b9 in select_result_sink::send_data_with_check (sent=<optimized out>, u=<optimized out>, items=<optimized out>, this=<optimized out>) at /test/10.5_dbg/sql/sql_class.h:5286
            #27 JOIN::rollup_send_data (this=this@entry=0x15167f075da0, idx=idx@entry=0) at /test/10.5_dbg/sql/sql_select.cc:26156
            #28 0x00005627766f845e in end_send_group (join=0x15167f075da0, join_tab=<optimized out>, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:21957
            #29 0x00005627766e3b83 in sub_select (join=0x15167f075da0, join_tab=0x15167f0775c0, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:20545
            #30 0x000056277671cf20 in do_select (procedure=<optimized out>, join=0x15167f075da0) at /test/10.5_dbg/sql/sql_select.cc:20136
            #31 JOIN::exec_inner (this=this@entry=0x15167f075da0) at /test/10.5_dbg/sql/sql_select.cc:4444
            #32 0x000056277671d289 in JOIN::exec (this=this@entry=0x15167f075da0) at /test/10.5_dbg/sql/sql_select.cc:4225
            #33 0x000056277671b59e in mysql_select (thd=thd@entry=0x15167f015088, tables=<optimized out>, fields=@0x15167f0742d0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x15167f074ba0, last = 0x15167f074ba0, elements = 1}, <No data fields>}, conds=0x0, og_num=1, order=<optimized out>, group=0x15167f075438, having=0x0, proc_param=0x0, select_options=2147748608, result=0x15167f075d78, unit=0x15167f0190a0, select_lex=0x15167f074180) at /test/10.5_dbg/sql/sql_select.cc:4649
            #34 0x000056277671b8cd in handle_select (thd=thd@entry=0x15167f015088, lex=lex@entry=0x15167f018fd8, result=result@entry=0x15167f075d78, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417
            #35 0x00005627766a51ed in execute_sqlcom_select (thd=thd@entry=0x15167f015088, all_tables=0x15167f074c08) at /test/10.5_dbg/sql/sql_parse.cc:6209
            #36 0x000056277669e312 in mysql_execute_command (thd=thd@entry=0x15167f015088) at /test/10.5_dbg/sql/sql_parse.cc:3939
            #37 0x00005627766ab15c in mysql_parse (thd=thd@entry=0x15167f015088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x15169a50b350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7993
            #38 0x0000562776697c60 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x15167f015088, packet=packet@entry=0x15167f067089 "", packet_length=packet_length@entry=61, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1874
            #39 0x000056277669643a in do_command (thd=0x15167f015088) at /test/10.5_dbg/sql/sql_parse.cc:1355
            #40 0x00005627767f1c47 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x151683d7a808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
            #41 0x00005627767f2363 in handle_one_connection (arg=arg@entry=0x151683d7a808) at /test/10.5_dbg/sql/sql_connect.cc:1313
            #42 0x0000562776c53902 in pfs_spawn_thread (arg=0x1516a1446c88) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
            #43 0x00001516a352b6db in start_thread (arg=0x15169a50c700) at pthread_create.c:463
            #44 0x00001516a292988f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            Bug confirmed present in:
            MariaDB: 10.4.14 (dbg), 10.5.4 (dbg)

            Bug confirmed not present in:
            MariaDB: 10.1.46 (dbg), 10.1.46 (opt), 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 10.3.24 (opt), 10.4.14 (opt), 10.5.4 (opt)
            MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

            Roel Roel Van de Paar added a comment - - edited SET SQL_MODE= '' ; CREATE TABLE t (a TIMESTAMP , b DATETIME, c TIME ) ENGINE=InnoDB; INSERT INTO t VALUES ( NULL , NULL , NULL ); SELECT CASE a WHEN a THEN a END FROM t GROUP BY a WITH ROLLUP ; Leads to: 10.5.4 4080e3acefd7e58d88c2f3539fb6a0fb359cf057 mysqld: /test/10.5_dbg/sql/item.h:1362: virtual bool Item::val_native(THD*, Native*): Assertion `0' failed. 10.5.4 4080e3acefd7e58d88c2f3539fb6a0fb359cf057 Core was generated by `/test/MD150620-mariadb-10.5.4-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'. Program terminated with signal SIGABRT, Aborted. #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57 [Current thread is 1 (Thread 0x15169a50c700 (LWP 3214203))] (gdb) bt #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57 #1 0x00005627771a64c6 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518 #2 0x0000562776948d60 in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330 #3 <signal handler called> #4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #5 0x00001516a2848801 in __GI_abort () at abort.c:79 #6 0x00001516a283839a in __assert_fail_base (fmt=0x1516a29bf7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5627774e056f "0", file=file@entry=0x5627772fe974 "/test/10.5_dbg/sql/item.h", line=line@entry=1362, function=function@entry=0x5627772feda0 <Item::val_native(THD*, Native*)::__PRETTY_FUNCTION__> "virtual bool Item::val_native(THD*, Native*)") at assert.c:92 #7 0x00001516a2838412 in __GI___assert_fail (assertion=assertion@entry=0x5627774e056f "0", file=file@entry=0x5627772fe974 "/test/10.5_dbg/sql/item.h", line=line@entry=1362, function=function@entry=0x5627772feda0 <Item::val_native(THD*, Native*)::__PRETTY_FUNCTION__> "virtual bool Item::val_native(THD*, Native*)") at assert.c:101 #8 0x00005627765b1405 in Item::val_native (this=0x15167f0783d0, thd=<optimized out>, to=<optimized out>) at /test/10.5_dbg/sql/item.h:1362 #9 0x000056277698b308 in Item::val_native_from_item (this=0x15167f076620, thd=0x15167f015088, item=0x15167f0783d0, to=0x15167f076508) at /test/10.5_dbg/sql/item.h:879 #10 0x000056277696face in Item_ref::val_native (this=<optimized out>, thd=<optimized out>, to=<optimized out>) at /test/10.5_dbg/sql/item.cc:8332 #11 0x0000562776885bd7 in Type_handler_timestamp_common::Item_val_native_with_conversion (this=0x562777f28b00 <type_handler_timestamp2>, thd=0x15167f015088, item=0x15167f076620, to=0x15167f076508) at /test/10.5_dbg/sql/sql_type.cc:8684 #12 0x000056277699418b in Item::val_native_with_conversion (th=<optimized out>, to=0x15167f076508, thd=<optimized out>, this=0x15167f076620) at /test/10.5_dbg/sql/item.h:1320 #13 cmp_item_timestamp::store_value (this=0x15167f0764f0, item=0x15167f076620) at /test/10.5_dbg/sql/item_cmpfunc.cc:4246 #14 0x0000562776995a67 in Predicant_to_list_comparator::cmp_arg (i=0, args=0x15167f074aa0, this=0x15167f074b10) at /test/10.5_dbg/sql/item_cmpfunc.h:1936 #15 Predicant_to_list_comparator::cmp (found_unknown_values=0x0, idx=<synthetic pointer>, args=0x15167f074aa0, this=0x15167f074b10) at /test/10.5_dbg/sql/item_cmpfunc.h:2126 #16 Item_func_case_simple::find_item (this=0x15167f074a10) at /test/10.5_dbg/sql/item_cmpfunc.cc:3026 #17 0x0000562776998985 in Item_func_case::native_op (this=0x15167f074a10, thd=0x15167f015088, to=0x15169a509e60) at /test/10.5_dbg/sql/item_cmpfunc.cc:3136 #18 0x00005627769a61c5 in Item_func_hybrid_field_type::val_native (this=0x15167f074a10, thd=0x15167f015088, to=0x15169a509e60) at /test/10.5_dbg/sql/item_func.h:907 #19 0x0000562776885de1 in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (this=0x15169a509e60, thd=0x15167f015088, item=0x15167f074a10, conv=<optimized out>) at /test/10.5_dbg/sql/sql_type.cc:8728 #20 0x0000562776886622 in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (item=0x15167f074a10, thd=<optimized out>, this=0x15169a509e60) at /test/10.5_dbg/sql/sql_type.h:2666 #21 Type_handler::Item_send_timestamp (this=<optimized out>, item=0x15167f074a10, protocol=0x15167f015650, buf=0x15169a509f40) at /test/10.5_dbg/sql/sql_type.cc:7210 #22 0x00005627767d9da3 in Type_handler_timestamp_common::Item_send (this=<optimized out>, item=<optimized out>, protocol=<optimized out>, buf=<optimized out>) at /test/10.5_dbg/sql/sql_type.h:6351 #23 0x00005627765b07a9 in Item::send (this=0x15167f074a10, protocol=0x15167f015650, buffer=0x15169a509f40) at /test/10.5_dbg/sql/item.h:1056 #24 0x00005627765ae519 in Protocol::send_result_set_row (this=this@entry=0x15167f015650, row_items=row_items@entry=0x15167f076560) at /test/10.5_dbg/sql/protocol.cc:1082 #25 0x000056277664013a in select_send::send_data (this=0x15167f075d78, items=@0x15167f076560: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x15167f076610, last = 0x15167f076610, elements = 1}, <No data fields>}) at /test/10.5_dbg/sql/sql_class.cc:3004 #26 0x00005627766f78b9 in select_result_sink::send_data_with_check (sent=<optimized out>, u=<optimized out>, items=<optimized out>, this=<optimized out>) at /test/10.5_dbg/sql/sql_class.h:5286 #27 JOIN::rollup_send_data (this=this@entry=0x15167f075da0, idx=idx@entry=0) at /test/10.5_dbg/sql/sql_select.cc:26156 #28 0x00005627766f845e in end_send_group (join=0x15167f075da0, join_tab=<optimized out>, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:21957 #29 0x00005627766e3b83 in sub_select (join=0x15167f075da0, join_tab=0x15167f0775c0, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:20545 #30 0x000056277671cf20 in do_select (procedure=<optimized out>, join=0x15167f075da0) at /test/10.5_dbg/sql/sql_select.cc:20136 #31 JOIN::exec_inner (this=this@entry=0x15167f075da0) at /test/10.5_dbg/sql/sql_select.cc:4444 #32 0x000056277671d289 in JOIN::exec (this=this@entry=0x15167f075da0) at /test/10.5_dbg/sql/sql_select.cc:4225 #33 0x000056277671b59e in mysql_select (thd=thd@entry=0x15167f015088, tables=<optimized out>, fields=@0x15167f0742d0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x15167f074ba0, last = 0x15167f074ba0, elements = 1}, <No data fields>}, conds=0x0, og_num=1, order=<optimized out>, group=0x15167f075438, having=0x0, proc_param=0x0, select_options=2147748608, result=0x15167f075d78, unit=0x15167f0190a0, select_lex=0x15167f074180) at /test/10.5_dbg/sql/sql_select.cc:4649 #34 0x000056277671b8cd in handle_select (thd=thd@entry=0x15167f015088, lex=lex@entry=0x15167f018fd8, result=result@entry=0x15167f075d78, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417 #35 0x00005627766a51ed in execute_sqlcom_select (thd=thd@entry=0x15167f015088, all_tables=0x15167f074c08) at /test/10.5_dbg/sql/sql_parse.cc:6209 #36 0x000056277669e312 in mysql_execute_command (thd=thd@entry=0x15167f015088) at /test/10.5_dbg/sql/sql_parse.cc:3939 #37 0x00005627766ab15c in mysql_parse (thd=thd@entry=0x15167f015088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x15169a50b350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7993 #38 0x0000562776697c60 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x15167f015088, packet=packet@entry=0x15167f067089 "", packet_length=packet_length@entry=61, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1874 #39 0x000056277669643a in do_command (thd=0x15167f015088) at /test/10.5_dbg/sql/sql_parse.cc:1355 #40 0x00005627767f1c47 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x151683d7a808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411 #41 0x00005627767f2363 in handle_one_connection (arg=arg@entry=0x151683d7a808) at /test/10.5_dbg/sql/sql_connect.cc:1313 #42 0x0000562776c53902 in pfs_spawn_thread (arg=0x1516a1446c88) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201 #43 0x00001516a352b6db in start_thread (arg=0x15169a50c700) at pthread_create.c:463 #44 0x00001516a292988f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Bug confirmed present in: MariaDB: 10.4.14 (dbg), 10.5.4 (dbg) Bug confirmed not present in: MariaDB: 10.1.46 (dbg), 10.1.46 (opt), 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 10.3.24 (opt), 10.4.14 (opt), 10.5.4 (opt) MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)
            Roel Roel Van de Paar added a comment - - edited

            Additional testcase only present in 10.5+ due to INET6 syntax, somewhat differing stacks

            CREATE TABLE t (a INET6);
            INSERT INTO t VALUES (NULL);
            SELECT IFNULL (a,'') FROM t GROUP BY a WITH ROLLUP;
            

            Leads to:

            10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug)

            mysqld: /test/10.9_dbg/sql/item.h:1569: virtual bool Item::val_native(THD*, Native*): Assertion `0' failed.
            

            10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug)

            Core was generated by `/test/MD160322-mariadb-10.9.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 0x1493d80ef700 (LWP 358363))]
            (gdb) bt
            #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
            #1  0x00001493e334f859 in __GI_abort () at abort.c:79
            #2  0x00001493e334f729 in __assert_fail_base (fmt=0x1493e34e5588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5640ca2311e7 "0", file=0x5640ca04d4f5 "/test/10.9_dbg/sql/item.h", line=1569, function=<optimized out>) at assert.c:92
            #3  0x00001493e3361006 in __GI___assert_fail (assertion=assertion@entry=0x5640ca2311e7 "0", file=file@entry=0x5640ca04d4f5 "/test/10.9_dbg/sql/item.h", line=line@entry=1569, function=function@entry=0x5640ca04d628 "virtual bool Item::val_native(THD*, Native*)") at assert.c:101
            #4  0x00005640c925669d in Item::val_native (this=0x149380017ab8, thd=<optimized out>, to=<optimized out>) at /test/10.9_dbg/sql/item.h:1569
            #5  0x00005640c96cc2bf in Item::val_native_from_item (to=0x1493d80ecde0, item=0x149380017ab8, thd=0x149380000db8, this=0x149380015f68) at /test/10.9_dbg/sql/item.h:974
            #6  Item_ref::val_native (this=0x149380015f68, thd=0x149380000db8, to=0x1493d80ecde0) at /test/10.9_dbg/sql/item.cc:8487
            #7  0x00005640c9ffc79d in FixedBinTypeBundle<Inet6>::Type_handler_fbt::Item_val_native_with_conversion (this=0x5640cb2d0ec0 <FixedBinTypeBundle<Inet6>::type_handler_fbt()::th>, thd=0x149380000db8, item=0x149380015f68, to=0x1493d80ecde0) at /test/10.9_dbg/sql/sql_string.h:276
            #8  0x00005640c96f9a43 in Item::val_native_with_conversion (th=0x5640cb2d0ec0 <FixedBinTypeBundle<Inet6>::type_handler_fbt()::th>, to=0x1493d80ecde0, thd=0x149380000db8, this=0x149380015f68) at /test/10.9_dbg/sql/item.h:1528
            #9  Item::val_native_with_conversion_from_item (handler=0x5640cb2d0ec0 <FixedBinTypeBundle<Inet6>::type_handler_fbt()::th>, to=0x1493d80ecde0, item=0x149380015f68, thd=0x149380000db8, this=0x149380014500) at /test/10.9_dbg/sql/item.h:988
            #10 Item_func_ifnull::native_op (this=0x149380014500, thd=0x149380000db8, to=0x1493d80ecde0) at /test/10.9_dbg/sql/item_cmpfunc.cc:2403
            #11 0x00005640c970e042 in Item_func_hybrid_field_type::val_native (this=this@entry=0x149380014500, thd=0x149380000db8, to=to@entry=0x1493d80ecde0) at /test/10.9_dbg/sql/item_func.h:931
            #12 0x00005640c9ff8121 in FixedBinTypeBundle<Inet6>::Type_handler_fbt::Item_func_hybrid_field_type_val_str (this=<optimized out>, item=0x149380014500, str=0x1493d80ecf40) at /test/10.9_dbg/sql/sql_string.h:276
            #13 0x00005640c970e0c1 in Item_func_hybrid_field_type::val_str (this=0x149380014500, str=0x1493d80ecf40) at /test/10.9_dbg/sql/sql_type.h:7452
            #14 0x00005640c95d1142 in Type_handler::Item_send_str (this=<optimized out>, item=0x149380014500, protocol=0x1493800013a0, buf=<optimized out>) at /test/10.9_dbg/sql/sql_type.cc:7468
            #15 0x00005640c9ff5ded in FixedBinTypeBundle<Inet6>::Type_handler_fbt::Item_send (this=<optimized out>, item=<optimized out>, p=<optimized out>, buf=<optimized out>) at /test/10.9_dbg/sql/sql_type_fixedbin.h:588
            #16 0x00005640c9255c64 in Item::send (this=0x149380014500, protocol=0x1493800013a0, buffer=0x1493d80ecf10) at /test/10.9_dbg/sql/item.h:1227
            #17 0x00005640c9291325 in Protocol::send_result_set_row (this=this@entry=0x1493800013a0, row_items=row_items@entry=0x149380015ec8) at /test/10.9_dbg/sql/protocol.cc:1328
            #18 0x00005640c932be89 in select_send::send_data (this=0x149380015750, items=@0x149380015ec8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x149380015f58, last = 0x149380015f58, elements = 1}, <No data fields>}) at /test/10.9_dbg/sql/sql_class.cc:3060
            #19 0x00005640c9421017 in select_result_sink::send_data_with_check (sent=<optimized out>, u=<optimized out>, items=<optimized out>, this=<optimized out>) at /test/10.9_dbg/sql/sql_class.h:5612
            #20 JOIN::rollup_send_data (this=this@entry=0x149380015778, idx=idx@entry=0) at /test/10.9_dbg/sql/sql_select.cc:26786
            #21 0x00005640c9421b97 in end_send_group (join=0x149380015778, join_tab=<optimized out>, end_of_records=<optimized out>) at /test/10.9_dbg/sql/sql_select.cc:22501
            #22 0x00005640c93fe519 in sub_select (join=0x149380015778, join_tab=0x149380016cb8, end_of_records=<optimized out>) at /test/10.9_dbg/sql/sql_select.cc:21039
            #23 0x00005640c94364b0 in do_select (procedure=<optimized out>, join=0x149380015778) at /test/10.9_dbg/sql/sql_select.cc:20642
            #24 JOIN::exec_inner (this=this@entry=0x149380015778) at /test/10.9_dbg/sql/sql_select.cc:4749
            #25 0x00005640c9436a26 in JOIN::exec (this=this@entry=0x149380015778) at /test/10.9_dbg/sql/sql_select.cc:4527
            #26 0x00005640c9434a35 in mysql_select (thd=thd@entry=0x149380000db8, tables=0x149380014620, fields=@0x149380014148: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1493800145b0, last = 0x1493800145b0, elements = 1}, <No data fields>}, conds=0x0, og_num=1, order=0x0, group=0x149380014e38, having=0x0, proc_param=0x0, select_options=2147748608, result=0x149380015750, unit=0x1493800051c8, select_lex=0x149380013ea8) at /test/10.9_dbg/sql/sql_select.cc:5007
            #27 0x00005640c9434cea in handle_select (thd=thd@entry=0x149380000db8, lex=lex@entry=0x1493800050f0, result=result@entry=0x149380015750, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.9_dbg/sql/sql_select.cc:543
            #28 0x00005640c9394246 in execute_sqlcom_select (thd=thd@entry=0x149380000db8, all_tables=0x149380014620) at /test/10.9_dbg/sql/sql_parse.cc:6252
            #29 0x00005640c93a11ad in mysql_execute_command (thd=thd@entry=0x149380000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_parse.cc:3943
            #30 0x00005640c938d437 in mysql_parse (thd=thd@entry=0x149380000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1493d80ee400) at /test/10.9_dbg/sql/sql_parse.cc:8027
            #31 0x00005640c939c0d3 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x149380000db8, packet=packet@entry=0x14938000b889 "", packet_length=packet_length@entry=50, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_class.h:1362
            #32 0x00005640c939f51a in do_command (thd=0x149380000db8, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_parse.cc:1402
            #33 0x00005640c951a228 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5640ccd7c7a8, put_in_cache=put_in_cache@entry=true) at /test/10.9_dbg/sql/sql_connect.cc:1418
            #34 0x00005640c951a82d in handle_one_connection (arg=arg@entry=0x5640ccd7c7a8) at /test/10.9_dbg/sql/sql_connect.cc:1312
            #35 0x00005640c99a0f23 in pfs_spawn_thread (arg=0x5640ccc8f9c8) at /test/10.9_dbg/storage/perfschema/pfs.cc:2201
            #36 0x00001493e3860609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #37 0x00001493e344c163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            qa-roel-2:/test/MD160322-mariadb-10.5.16-linux-x86_64-dbg$ ./stack

            10.5.16 73fee39ea62037780c59161507e89dd76c10b7a3 (Debug)

            mysqld: /test/10.5_dbg/sql/item.h:1371: virtual bool Item::val_native(THD*, Native*): Assertion `0' failed.
            

            10.5.16 73fee39ea62037780c59161507e89dd76c10b7a3 (Debug)

            Core was generated by `/test/MD160322-mariadb-10.5.16-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
            #1  0x000014ea564ea859 in __GI_abort () at abort.c:79
            #2  0x000014ea564ea729 in __assert_fail_base (fmt=0x14ea56680588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x564311ec3226 "0", file=0x564311cf3888 "/test/10.5_dbg/sql/item.h", line=1371, function=<optimized out>) at assert.c:92
            #3  0x000014ea564fc006 in __GI___assert_fail (assertion=assertion@entry=0x564311ec3226 "0", file=file@entry=0x564311cf3888 "/test/10.5_dbg/sql/item.h", line=line@entry=1371, function=function@entry=0x564311cf39e8 "virtual bool Item::val_native(THD*, Native*)") at assert.c:101
            #4  0x0000564310ef40b1 in Item::val_native (this=0x14e9c4017a98, thd=<optimized out>, to=<optimized out>) at /test/10.5_dbg/sql/item.h:1371
            #5  0x00005643112f00ad in Item::val_native_from_item (to=0x14ea54110080, item=0x14e9c4017a98, thd=0x14e9c4000db8, this=0x14e9c4015f28) at /test/10.5_dbg/sql/item.h:878
            #6  Item_ref::val_native (this=0x14e9c4015f28, thd=0x14e9c4000db8, to=0x14ea54110080) at /test/10.5_dbg/sql/item.cc:8443
            #7  0x0000564311cb3795 in Type_handler_inet6::Item_val_native_with_conversion (this=0x564312f514c0 <type_handler_inet6>, thd=0x14e9c4000db8, item=0x14e9c4015f28, to=0x14ea54110080) at /test/10.5_dbg/plugin/type_inet/sql_type_inet.h:778
            #8  0x000056431131ed38 in Item::val_native_with_conversion (th=0x564312f514c0 <type_handler_inet6>, to=0x14ea54110080, thd=0x14e9c4000db8, this=0x14e9c4015f28) at /test/10.5_dbg/sql/item.h:1330
            #9  Item::val_native_with_conversion_from_item (handler=0x564312f514c0 <type_handler_inet6>, to=0x14ea54110080, item=0x14e9c4015f28, thd=0x14e9c4000db8, this=0x14e9c4014468) at /test/10.5_dbg/sql/item.h:892
            #10 Item_func_ifnull::native_op (this=0x14e9c4014468, thd=0x14e9c4000db8, to=0x14ea54110080) at /test/10.5_dbg/sql/item_cmpfunc.cc:2419
            #11 0x0000564311333ba1 in Item_func_hybrid_field_type::val_native (this=this@entry=0x14e9c4014468, thd=0x14e9c4000db8, to=to@entry=0x14ea54110080) at /test/10.5_dbg/sql/item_func.h:940
            #12 0x0000564311cb2d57 in Type_handler_inet6::Item_func_hybrid_field_type_val_str (this=<optimized out>, item=0x14e9c4014468, str=0x14ea541101f0) at /test/10.5_dbg/plugin/type_inet/sql_type_inet.h:838
            #13 0x0000564311333cfc in Item_func_hybrid_field_type::val_str (this=0x14e9c4014468, str=0x14ea541101f0) at /test/10.5_dbg/sql/sql_type.h:7449
            #14 0x00005643111f7826 in Type_handler::Item_send_str (this=<optimized out>, item=0x14e9c4014468, protocol=0x14e9c4001390, buf=<optimized out>) at /test/10.5_dbg/sql/sql_type.cc:7454
            #15 0x0000564311caefed in Type_handler_inet6::Item_send (this=<optimized out>, item=<optimized out>, p=<optimized out>, buf=<optimized out>) at /test/10.5_dbg/plugin/type_inet/sql_type_inet.h:586
            #16 0x0000564310ef3494 in Item::send (this=0x14e9c4014468, protocol=0x14e9c4001390, buffer=0x14ea541101c0) at /test/10.5_dbg/sql/item.h:1066
            #17 0x0000564310ef09b0 in Protocol::send_result_set_row (this=this@entry=0x14e9c4001390, row_items=row_items@entry=0x14e9c4015e68) at /test/10.5_dbg/sql/protocol.cc:1087
            #18 0x0000564310f8bab1 in select_send::send_data (this=0x14e9c4015730, items=@0x14e9c4015e68: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14e9c4015f18, last = 0x14e9c4015f18, elements = 1}, <No data fields>}) at /test/10.5_dbg/sql/sql_class.cc:3081
            #19 0x000056431106b04d in select_result_sink::send_data_with_check (sent=<optimized out>, u=<optimized out>, items=<optimized out>, this=<optimized out>) at /test/10.5_dbg/sql/sql_class.h:5342
            #20 JOIN::rollup_send_data (this=this@entry=0x14e9c4015758, idx=idx@entry=0) at /test/10.5_dbg/sql/sql_select.cc:26533
            #21 0x000056431106bbe9 in end_send_group (join=0x14e9c4015758, join_tab=<optimized out>, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:22289
            #22 0x00005643110478ec in sub_select (join=0x14e9c4015758, join_tab=0x14e9c4016c78, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:20857
            #23 0x000056431108058a in do_select (procedure=<optimized out>, join=0x14e9c4015758) at /test/10.5_dbg/sql/sql_select.cc:20447
            #24 JOIN::exec_inner (this=this@entry=0x14e9c4015758) at /test/10.5_dbg/sql/sql_select.cc:4538
            #25 0x0000564311080a9e in JOIN::exec (this=this@entry=0x14e9c4015758) at /test/10.5_dbg/sql/sql_select.cc:4318
            #26 0x000056431107ec25 in mysql_select (thd=thd@entry=0x14e9c4000db8, tables=0x14e9c40145a8, fields=@0x14e9c4013f08: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14e9c4014538, last = 0x14e9c4014538, elements = 1}, <No data fields>}, conds=0x0, og_num=1, order=0x0, group=0x14e9c4014de0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14e9c4015730, unit=0x14e9c4004f60, select_lex=0x14e9c4013db8) at /test/10.5_dbg/sql/sql_select.cc:4795
            #27 0x000056431107eeeb in handle_select (thd=thd@entry=0x14e9c4000db8, lex=lex@entry=0x14e9c4004e98, result=result@entry=0x14e9c4015730, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:444
            #28 0x0000564310ff0503 in execute_sqlcom_select (thd=thd@entry=0x14e9c4000db8, all_tables=0x14e9c40145a8) at /test/10.5_dbg/sql/sql_parse.cc:6314
            #29 0x0000564310ffdc68 in mysql_execute_command (thd=thd@entry=0x14e9c4000db8) at /test/10.5_dbg/sql/sql_parse.cc:4005
            #30 0x0000564310fe8fe2 in mysql_parse (thd=thd@entry=0x14e9c4000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14ea541113d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:8100
            #31 0x0000564310ff8835 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14e9c4000db8, packet=packet@entry=0x14e9c400b4a9 "", packet_length=packet_length@entry=50, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_class.h:1290
            #32 0x0000564310ffc0b1 in do_command (thd=0x14e9c4000db8) at /test/10.5_dbg/sql/sql_parse.cc:1370
            #33 0x0000564311158eb6 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x56431453a7d8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1418
            #34 0x00005643111595b9 in handle_one_connection (arg=arg@entry=0x56431453a7d8) at /test/10.5_dbg/sql/sql_connect.cc:1312
            #35 0x0000564311612acb in pfs_spawn_thread (arg=0x564314460688) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
            #36 0x000014ea569fb609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #37 0x000014ea565e7163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            Bug confirmed present in:
            MariaDB: 10.5.16 (dbg), 10.6.8 (dbg), 10.7.4 (dbg), 10.8.3 (dbg), 10.9.0 (dbg)

            Bug (or feature/syntax) confirmed not present in:
            MariaDB: 10.2.44 (dbg), 10.2.44 (opt), 10.3.35 (dbg), 10.3.35 (opt), 10.4.25 (dbg), 10.4.25 (opt), 10.5.16 (opt), 10.6.8 (opt), 10.7.4 (opt), 10.8.3 (opt), 10.9.0 (opt)
            MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.37 (dbg), 5.7.37 (opt), 8.0.28 (dbg), 8.0.28 (opt)

            Roel Roel Van de Paar added a comment - - edited Additional testcase only present in 10.5+ due to INET6 syntax, somewhat differing stacks CREATE TABLE t (a INET6); INSERT INTO t VALUES ( NULL ); SELECT IFNULL (a, '' ) FROM t GROUP BY a WITH ROLLUP ; Leads to: 10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug) mysqld: /test/10.9_dbg/sql/item.h:1569: virtual bool Item::val_native(THD*, Native*): Assertion `0' failed. 10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug) Core was generated by `/test/MD160322-mariadb-10.9.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 0x1493d80ef700 (LWP 358363))] (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00001493e334f859 in __GI_abort () at abort.c:79 #2 0x00001493e334f729 in __assert_fail_base (fmt=0x1493e34e5588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5640ca2311e7 "0", file=0x5640ca04d4f5 "/test/10.9_dbg/sql/item.h", line=1569, function=<optimized out>) at assert.c:92 #3 0x00001493e3361006 in __GI___assert_fail (assertion=assertion@entry=0x5640ca2311e7 "0", file=file@entry=0x5640ca04d4f5 "/test/10.9_dbg/sql/item.h", line=line@entry=1569, function=function@entry=0x5640ca04d628 "virtual bool Item::val_native(THD*, Native*)") at assert.c:101 #4 0x00005640c925669d in Item::val_native (this=0x149380017ab8, thd=<optimized out>, to=<optimized out>) at /test/10.9_dbg/sql/item.h:1569 #5 0x00005640c96cc2bf in Item::val_native_from_item (to=0x1493d80ecde0, item=0x149380017ab8, thd=0x149380000db8, this=0x149380015f68) at /test/10.9_dbg/sql/item.h:974 #6 Item_ref::val_native (this=0x149380015f68, thd=0x149380000db8, to=0x1493d80ecde0) at /test/10.9_dbg/sql/item.cc:8487 #7 0x00005640c9ffc79d in FixedBinTypeBundle<Inet6>::Type_handler_fbt::Item_val_native_with_conversion (this=0x5640cb2d0ec0 <FixedBinTypeBundle<Inet6>::type_handler_fbt()::th>, thd=0x149380000db8, item=0x149380015f68, to=0x1493d80ecde0) at /test/10.9_dbg/sql/sql_string.h:276 #8 0x00005640c96f9a43 in Item::val_native_with_conversion (th=0x5640cb2d0ec0 <FixedBinTypeBundle<Inet6>::type_handler_fbt()::th>, to=0x1493d80ecde0, thd=0x149380000db8, this=0x149380015f68) at /test/10.9_dbg/sql/item.h:1528 #9 Item::val_native_with_conversion_from_item (handler=0x5640cb2d0ec0 <FixedBinTypeBundle<Inet6>::type_handler_fbt()::th>, to=0x1493d80ecde0, item=0x149380015f68, thd=0x149380000db8, this=0x149380014500) at /test/10.9_dbg/sql/item.h:988 #10 Item_func_ifnull::native_op (this=0x149380014500, thd=0x149380000db8, to=0x1493d80ecde0) at /test/10.9_dbg/sql/item_cmpfunc.cc:2403 #11 0x00005640c970e042 in Item_func_hybrid_field_type::val_native (this=this@entry=0x149380014500, thd=0x149380000db8, to=to@entry=0x1493d80ecde0) at /test/10.9_dbg/sql/item_func.h:931 #12 0x00005640c9ff8121 in FixedBinTypeBundle<Inet6>::Type_handler_fbt::Item_func_hybrid_field_type_val_str (this=<optimized out>, item=0x149380014500, str=0x1493d80ecf40) at /test/10.9_dbg/sql/sql_string.h:276 #13 0x00005640c970e0c1 in Item_func_hybrid_field_type::val_str (this=0x149380014500, str=0x1493d80ecf40) at /test/10.9_dbg/sql/sql_type.h:7452 #14 0x00005640c95d1142 in Type_handler::Item_send_str (this=<optimized out>, item=0x149380014500, protocol=0x1493800013a0, buf=<optimized out>) at /test/10.9_dbg/sql/sql_type.cc:7468 #15 0x00005640c9ff5ded in FixedBinTypeBundle<Inet6>::Type_handler_fbt::Item_send (this=<optimized out>, item=<optimized out>, p=<optimized out>, buf=<optimized out>) at /test/10.9_dbg/sql/sql_type_fixedbin.h:588 #16 0x00005640c9255c64 in Item::send (this=0x149380014500, protocol=0x1493800013a0, buffer=0x1493d80ecf10) at /test/10.9_dbg/sql/item.h:1227 #17 0x00005640c9291325 in Protocol::send_result_set_row (this=this@entry=0x1493800013a0, row_items=row_items@entry=0x149380015ec8) at /test/10.9_dbg/sql/protocol.cc:1328 #18 0x00005640c932be89 in select_send::send_data (this=0x149380015750, items=@0x149380015ec8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x149380015f58, last = 0x149380015f58, elements = 1}, <No data fields>}) at /test/10.9_dbg/sql/sql_class.cc:3060 #19 0x00005640c9421017 in select_result_sink::send_data_with_check (sent=<optimized out>, u=<optimized out>, items=<optimized out>, this=<optimized out>) at /test/10.9_dbg/sql/sql_class.h:5612 #20 JOIN::rollup_send_data (this=this@entry=0x149380015778, idx=idx@entry=0) at /test/10.9_dbg/sql/sql_select.cc:26786 #21 0x00005640c9421b97 in end_send_group (join=0x149380015778, join_tab=<optimized out>, end_of_records=<optimized out>) at /test/10.9_dbg/sql/sql_select.cc:22501 #22 0x00005640c93fe519 in sub_select (join=0x149380015778, join_tab=0x149380016cb8, end_of_records=<optimized out>) at /test/10.9_dbg/sql/sql_select.cc:21039 #23 0x00005640c94364b0 in do_select (procedure=<optimized out>, join=0x149380015778) at /test/10.9_dbg/sql/sql_select.cc:20642 #24 JOIN::exec_inner (this=this@entry=0x149380015778) at /test/10.9_dbg/sql/sql_select.cc:4749 #25 0x00005640c9436a26 in JOIN::exec (this=this@entry=0x149380015778) at /test/10.9_dbg/sql/sql_select.cc:4527 #26 0x00005640c9434a35 in mysql_select (thd=thd@entry=0x149380000db8, tables=0x149380014620, fields=@0x149380014148: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1493800145b0, last = 0x1493800145b0, elements = 1}, <No data fields>}, conds=0x0, og_num=1, order=0x0, group=0x149380014e38, having=0x0, proc_param=0x0, select_options=2147748608, result=0x149380015750, unit=0x1493800051c8, select_lex=0x149380013ea8) at /test/10.9_dbg/sql/sql_select.cc:5007 #27 0x00005640c9434cea in handle_select (thd=thd@entry=0x149380000db8, lex=lex@entry=0x1493800050f0, result=result@entry=0x149380015750, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.9_dbg/sql/sql_select.cc:543 #28 0x00005640c9394246 in execute_sqlcom_select (thd=thd@entry=0x149380000db8, all_tables=0x149380014620) at /test/10.9_dbg/sql/sql_parse.cc:6252 #29 0x00005640c93a11ad in mysql_execute_command (thd=thd@entry=0x149380000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_parse.cc:3943 #30 0x00005640c938d437 in mysql_parse (thd=thd@entry=0x149380000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1493d80ee400) at /test/10.9_dbg/sql/sql_parse.cc:8027 #31 0x00005640c939c0d3 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x149380000db8, packet=packet@entry=0x14938000b889 "", packet_length=packet_length@entry=50, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_class.h:1362 #32 0x00005640c939f51a in do_command (thd=0x149380000db8, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_parse.cc:1402 #33 0x00005640c951a228 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5640ccd7c7a8, put_in_cache=put_in_cache@entry=true) at /test/10.9_dbg/sql/sql_connect.cc:1418 #34 0x00005640c951a82d in handle_one_connection (arg=arg@entry=0x5640ccd7c7a8) at /test/10.9_dbg/sql/sql_connect.cc:1312 #35 0x00005640c99a0f23 in pfs_spawn_thread (arg=0x5640ccc8f9c8) at /test/10.9_dbg/storage/perfschema/pfs.cc:2201 #36 0x00001493e3860609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #37 0x00001493e344c163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 qa-roel-2:/test/MD160322-mariadb-10.5.16-linux-x86_64-dbg$ ./stack 10.5.16 73fee39ea62037780c59161507e89dd76c10b7a3 (Debug) mysqld: /test/10.5_dbg/sql/item.h:1371: virtual bool Item::val_native(THD*, Native*): Assertion `0' failed. 10.5.16 73fee39ea62037780c59161507e89dd76c10b7a3 (Debug) Core was generated by `/test/MD160322-mariadb-10.5.16-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 #1 0x000014ea564ea859 in __GI_abort () at abort.c:79 #2 0x000014ea564ea729 in __assert_fail_base (fmt=0x14ea56680588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x564311ec3226 "0", file=0x564311cf3888 "/test/10.5_dbg/sql/item.h", line=1371, function=<optimized out>) at assert.c:92 #3 0x000014ea564fc006 in __GI___assert_fail (assertion=assertion@entry=0x564311ec3226 "0", file=file@entry=0x564311cf3888 "/test/10.5_dbg/sql/item.h", line=line@entry=1371, function=function@entry=0x564311cf39e8 "virtual bool Item::val_native(THD*, Native*)") at assert.c:101 #4 0x0000564310ef40b1 in Item::val_native (this=0x14e9c4017a98, thd=<optimized out>, to=<optimized out>) at /test/10.5_dbg/sql/item.h:1371 #5 0x00005643112f00ad in Item::val_native_from_item (to=0x14ea54110080, item=0x14e9c4017a98, thd=0x14e9c4000db8, this=0x14e9c4015f28) at /test/10.5_dbg/sql/item.h:878 #6 Item_ref::val_native (this=0x14e9c4015f28, thd=0x14e9c4000db8, to=0x14ea54110080) at /test/10.5_dbg/sql/item.cc:8443 #7 0x0000564311cb3795 in Type_handler_inet6::Item_val_native_with_conversion (this=0x564312f514c0 <type_handler_inet6>, thd=0x14e9c4000db8, item=0x14e9c4015f28, to=0x14ea54110080) at /test/10.5_dbg/plugin/type_inet/sql_type_inet.h:778 #8 0x000056431131ed38 in Item::val_native_with_conversion (th=0x564312f514c0 <type_handler_inet6>, to=0x14ea54110080, thd=0x14e9c4000db8, this=0x14e9c4015f28) at /test/10.5_dbg/sql/item.h:1330 #9 Item::val_native_with_conversion_from_item (handler=0x564312f514c0 <type_handler_inet6>, to=0x14ea54110080, item=0x14e9c4015f28, thd=0x14e9c4000db8, this=0x14e9c4014468) at /test/10.5_dbg/sql/item.h:892 #10 Item_func_ifnull::native_op (this=0x14e9c4014468, thd=0x14e9c4000db8, to=0x14ea54110080) at /test/10.5_dbg/sql/item_cmpfunc.cc:2419 #11 0x0000564311333ba1 in Item_func_hybrid_field_type::val_native (this=this@entry=0x14e9c4014468, thd=0x14e9c4000db8, to=to@entry=0x14ea54110080) at /test/10.5_dbg/sql/item_func.h:940 #12 0x0000564311cb2d57 in Type_handler_inet6::Item_func_hybrid_field_type_val_str (this=<optimized out>, item=0x14e9c4014468, str=0x14ea541101f0) at /test/10.5_dbg/plugin/type_inet/sql_type_inet.h:838 #13 0x0000564311333cfc in Item_func_hybrid_field_type::val_str (this=0x14e9c4014468, str=0x14ea541101f0) at /test/10.5_dbg/sql/sql_type.h:7449 #14 0x00005643111f7826 in Type_handler::Item_send_str (this=<optimized out>, item=0x14e9c4014468, protocol=0x14e9c4001390, buf=<optimized out>) at /test/10.5_dbg/sql/sql_type.cc:7454 #15 0x0000564311caefed in Type_handler_inet6::Item_send (this=<optimized out>, item=<optimized out>, p=<optimized out>, buf=<optimized out>) at /test/10.5_dbg/plugin/type_inet/sql_type_inet.h:586 #16 0x0000564310ef3494 in Item::send (this=0x14e9c4014468, protocol=0x14e9c4001390, buffer=0x14ea541101c0) at /test/10.5_dbg/sql/item.h:1066 #17 0x0000564310ef09b0 in Protocol::send_result_set_row (this=this@entry=0x14e9c4001390, row_items=row_items@entry=0x14e9c4015e68) at /test/10.5_dbg/sql/protocol.cc:1087 #18 0x0000564310f8bab1 in select_send::send_data (this=0x14e9c4015730, items=@0x14e9c4015e68: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14e9c4015f18, last = 0x14e9c4015f18, elements = 1}, <No data fields>}) at /test/10.5_dbg/sql/sql_class.cc:3081 #19 0x000056431106b04d in select_result_sink::send_data_with_check (sent=<optimized out>, u=<optimized out>, items=<optimized out>, this=<optimized out>) at /test/10.5_dbg/sql/sql_class.h:5342 #20 JOIN::rollup_send_data (this=this@entry=0x14e9c4015758, idx=idx@entry=0) at /test/10.5_dbg/sql/sql_select.cc:26533 #21 0x000056431106bbe9 in end_send_group (join=0x14e9c4015758, join_tab=<optimized out>, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:22289 #22 0x00005643110478ec in sub_select (join=0x14e9c4015758, join_tab=0x14e9c4016c78, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:20857 #23 0x000056431108058a in do_select (procedure=<optimized out>, join=0x14e9c4015758) at /test/10.5_dbg/sql/sql_select.cc:20447 #24 JOIN::exec_inner (this=this@entry=0x14e9c4015758) at /test/10.5_dbg/sql/sql_select.cc:4538 #25 0x0000564311080a9e in JOIN::exec (this=this@entry=0x14e9c4015758) at /test/10.5_dbg/sql/sql_select.cc:4318 #26 0x000056431107ec25 in mysql_select (thd=thd@entry=0x14e9c4000db8, tables=0x14e9c40145a8, fields=@0x14e9c4013f08: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14e9c4014538, last = 0x14e9c4014538, elements = 1}, <No data fields>}, conds=0x0, og_num=1, order=0x0, group=0x14e9c4014de0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14e9c4015730, unit=0x14e9c4004f60, select_lex=0x14e9c4013db8) at /test/10.5_dbg/sql/sql_select.cc:4795 #27 0x000056431107eeeb in handle_select (thd=thd@entry=0x14e9c4000db8, lex=lex@entry=0x14e9c4004e98, result=result@entry=0x14e9c4015730, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:444 #28 0x0000564310ff0503 in execute_sqlcom_select (thd=thd@entry=0x14e9c4000db8, all_tables=0x14e9c40145a8) at /test/10.5_dbg/sql/sql_parse.cc:6314 #29 0x0000564310ffdc68 in mysql_execute_command (thd=thd@entry=0x14e9c4000db8) at /test/10.5_dbg/sql/sql_parse.cc:4005 #30 0x0000564310fe8fe2 in mysql_parse (thd=thd@entry=0x14e9c4000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14ea541113d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:8100 #31 0x0000564310ff8835 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14e9c4000db8, packet=packet@entry=0x14e9c400b4a9 "", packet_length=packet_length@entry=50, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_class.h:1290 #32 0x0000564310ffc0b1 in do_command (thd=0x14e9c4000db8) at /test/10.5_dbg/sql/sql_parse.cc:1370 #33 0x0000564311158eb6 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x56431453a7d8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1418 #34 0x00005643111595b9 in handle_one_connection (arg=arg@entry=0x56431453a7d8) at /test/10.5_dbg/sql/sql_connect.cc:1312 #35 0x0000564311612acb in pfs_spawn_thread (arg=0x564314460688) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201 #36 0x000014ea569fb609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #37 0x000014ea565e7163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Bug confirmed present in: MariaDB: 10.5.16 (dbg), 10.6.8 (dbg), 10.7.4 (dbg), 10.8.3 (dbg), 10.9.0 (dbg) Bug (or feature/syntax) confirmed not present in: MariaDB: 10.2.44 (dbg), 10.2.44 (opt), 10.3.35 (dbg), 10.3.35 (opt), 10.4.25 (dbg), 10.4.25 (opt), 10.5.16 (opt), 10.6.8 (opt), 10.7.4 (opt), 10.8.3 (opt), 10.9.0 (opt) MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.37 (dbg), 5.7.37 (opt), 8.0.28 (dbg), 8.0.28 (opt)
            Roel Roel Van de Paar added a comment - - edited

            SET sql_mode='';
            CREATE TABLE t (a UUID);
            INSERT INTO t (a) VALUES (0);
            SELECT IFNULL (a,'') FROM t GROUP BY a WITH ROLLUP;
            

            Leads to slightly different stack (<UUID>). UniqueID:

            0|SIGABRT|Item::val_native|Item::val_native_from_item|Item_ref::val_native|FixedBinTypeBundle<UUID>::Type_handler_fbt::Item_val_native_with_conversio

            Roel Roel Van de Paar added a comment - - edited SET sql_mode=''; CREATE TABLE t (a UUID); INSERT INTO t (a) VALUES (0); SELECT IFNULL (a,'') FROM t GROUP BY a WITH ROLLUP; Leads to slightly different stack (<UUID>). UniqueID: 0|SIGABRT|Item::val_native|Item::val_native_from_item|Item_ref::val_native|FixedBinTypeBundle<UUID>::Type_handler_fbt::Item_val_native_with_conversio
            Roel Roel Van de Paar added a comment - - edited

            Please also test any fixes with

            SET sql_mode='';
            CREATE TABLE t (a INET6);
            INSERT INTO t VALUES (1),(1);
            SELECT CASE a WHEN a THEN a END FROM t GROUP BY a WITH ROLLUP;
            

            And

            CREATE TABLE t (a INET6);
            INSERT INTO t VALUES();
            SELECT CASE a WHEN a THEN a END FROM t GROUP BY a WITH ROLLUP;
            

            The second t/c leads to

            CS 11.7.0 4016c905cbabea7f29ed282dc2125254c7c0d419 (Debug)

            0|SIGABRT|Item::val_native|Item::val_native_from_item|Item_ref::val_native|Type_handler_fbt<Inet6, Type_collection_inet>::Fbt::make_from_item
            

            Roel Roel Van de Paar added a comment - - edited Please also test any fixes with SET sql_mode= '' ; CREATE TABLE t (a INET6); INSERT INTO t VALUES (1),(1); SELECT CASE a WHEN a THEN a END FROM t GROUP BY a WITH ROLLUP ; And CREATE TABLE t (a INET6); INSERT INTO t VALUES (); SELECT CASE a WHEN a THEN a END FROM t GROUP BY a WITH ROLLUP ; The second t/c leads to CS 11.7.0 4016c905cbabea7f29ed282dc2125254c7c0d419 (Debug) 0|SIGABRT|Item::val_native|Item::val_native_from_item|Item_ref::val_native|Type_handler_fbt<Inet6, Type_collection_inet>::Fbt::make_from_item

            CREATE TABLE t (a TIMESTAMP);
            INSERT INTO t VALUES (now());
            SELECT (SELECT * FROM t GROUP BY a WITH ROLLUP HAVING a IS NULL);
            

            Leads to slightly different stack.

            0|SIGABRT|Item::val_native|Item::val_native_result|Type_handler_timestamp_common::Item_val_native_with_conversion_result|Item::val_native_with_conversion_result
            

            11.1.0 2b61ff8f2221745f0a96855a0feb0825c426f993 (Debug)

            mariadbd: /test/11.1_dbg/sql/item.h:1583: virtual bool Item::val_native(THD*, Native*): Assertion `0' failed.
            

            11.1.0 2b61ff8f2221745f0a96855a0feb0825c426f993 (Debug)

            Core was generated by `/test/MD040423-mariadb-11.1.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --cor'.
            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 0x14b4c4ea8700 (LWP 3546026))]
            (gdb) bt
            #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
            #1  0x000014b4de634859 in __GI_abort () at abort.c:79
            #2  0x000014b4de634729 in __assert_fail_base (fmt=0x14b4de7ca588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x561b96560ff1 "0", file=0x561b9638b6d5 "/test/11.1_dbg/sql/item.h", line=1583, function=<optimized out>) at assert.c:92
            #3  0x000014b4de645fd6 in __GI___assert_fail (assertion=assertion@entry=0x561b96560ff1 "0", file=file@entry=0x561b9638b6d5 "/test/11.1_dbg/sql/item.h", line=line@entry=1583, function=function@entry=0x561b9638b808 "virtual bool Item::val_native(THD*, Native*)") at assert.c:101
            #4  0x0000561b956d46df in Item::val_native (this=0x14b46c0686e8, thd=<optimized out>, to=<optimized out>) at /test/11.1_dbg/sql/item.h:1583
            #5  0x0000561b956d3d5d in Item::val_native_result (this=<optimized out>, thd=<optimized out>, to=<optimized out>) at /test/11.1_dbg/sql/item.h:1588
            #6  0x0000561b95a10931 in Type_handler_timestamp_common::Item_val_native_with_conversion_result (this=0x561b96da4d50 <type_handler_timestamp2>, thd=0x14b46c000d48, item=0x14b46c0686e8, to=0x14b46c016f08) at /test/11.1_dbg/sql/sql_type.cc:9063
            #7  0x0000561b95afe531 in Item::val_native_with_conversion_result (th=0x561b96da4d50 <type_handler_timestamp2>, to=0x14b46c016f08, thd=<optimized out>, this=0x14b46c0686e8) at /test/11.1_dbg/sql/item.h:1547
            #8  Item_cache_timestamp::cache_value (this=0x14b46c016e68) at /test/11.1_dbg/sql/item.cc:10383
            #9  0x0000561b95bf5cd2 in Item_singlerow_subselect::store (this=this@entry=0x14b46c014ff0, i=i@entry=0, item=<optimized out>) at /test/11.1_dbg/sql/item_subselect.cc:1298
            #10 0x0000561b95786d3c in select_singlerow_subselect::send_data (this=<optimized out>, items=<optimized out>) at /test/11.1_dbg/sql/sql_class.cc:3654
            #11 0x0000561b95876a6b in select_result_sink::send_data_with_check (sent=<optimized out>, u=<optimized out>, items=<optimized out>, this=<optimized out>) at /test/11.1_dbg/sql/sql_class.h:5748
            #12 JOIN::rollup_send_data (this=this@entry=0x14b46c0164c8, idx=idx@entry=0) at /test/11.1_dbg/sql/sql_select.cc:28797
            #13 0x0000561b95877220 in end_send_group (join=0x14b46c0164c8, join_tab=<optimized out>, end_of_records=<optimized out>) at /test/11.1_dbg/sql/sql_select.cc:24476
            #14 0x0000561b95852744 in sub_select (join=0x14b46c0164c8, join_tab=0x14b46c067650, end_of_records=true) at /test/11.1_dbg/sql/sql_select.cc:22970
            #15 0x0000561b9588aaba in do_select (procedure=<optimized out>, join=0x14b46c0164c8) at /test/11.1_dbg/sql/sql_select.cc:22571
            #16 JOIN::exec_inner (this=this@entry=0x14b46c0164c8) at /test/11.1_dbg/sql/sql_select.cc:4897
            #17 0x0000561b9588afae in JOIN::exec (this=0x14b46c0164c8) at /test/11.1_dbg/sql/sql_select.cc:4674
            #18 0x0000561b95bf3c40 in subselect_single_select_engine::exec (this=0x14b46c015180) at /test/11.1_dbg/sql/item_subselect.cc:4159
            #19 0x0000561b95bf328e in Item_subselect::exec (this=0x14b46c014ff0) at /test/11.1_dbg/sql/item_subselect.cc:812
            #20 0x0000561b95bf1c83 in Item_singlerow_subselect::val_native (this=0x14b46c014ff0, thd=0x14b46c000d48, to=0x14b4c4ea5f30) at /test/11.1_dbg/sql/item_subselect.cc:1503
            #21 0x0000561b95a10a97 in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (this=0x14b4c4ea5f30, thd=0x14b46c000d48, item=0x14b46c014ff0, conv=<optimized out>) at /test/11.1_dbg/sql/sql_type.cc:9091
            #22 0x0000561b95a12270 in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (item=0x14b46c014ff0, thd=<optimized out>, this=0x14b4c4ea5f30) at /test/11.1_dbg/sql/sql_type.h:2889
            #23 Type_handler::Item_send_timestamp (this=<optimized out>, item=0x14b46c014ff0, protocol=0x14b46c001358, buf=0x14b4c4ea5fe0) at /test/11.1_dbg/sql/sql_type.cc:7519
            #24 0x0000561b9594a957 in Type_handler_timestamp_common::Item_send (this=<optimized out>, item=<optimized out>, protocol=<optimized out>, buf=<optimized out>) at /test/11.1_dbg/sql/sql_type.h:6642
            #25 0x0000561b956d3c48 in Item::send (this=0x14b46c014ff0, protocol=0x14b46c001358, buffer=0x14b4c4ea5fe0) at /test/11.1_dbg/sql/item.h:1235
            #26 0x0000561b9570af71 in Protocol::send_result_set_row (this=this@entry=0x14b46c001358, row_items=row_items@entry=0x14b46c013510) at /test/11.1_dbg/sql/protocol.cc:1332
            #27 0x0000561b95793441 in select_send::send_data (this=0x14b46c015b88, items=@0x14b46c013510: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b46c0151c0, last = 0x14b46c0151c0, elements = 1}, <No data fields>}) at /test/11.1_dbg/sql/sql_class.cc:3102
            #28 0x0000561b95889fbe in select_result_sink::send_data_with_check (sent=0, u=<optimized out>, items=<optimized out>, this=<optimized out>) at /test/11.1_dbg/sql/sql_class.h:5748
            #29 JOIN::exec_inner (this=this@entry=0x14b46c015bb0) at /test/11.1_dbg/sql/sql_select.cc:4763
            #30 0x0000561b9588afae in JOIN::exec (this=this@entry=0x14b46c015bb0) at /test/11.1_dbg/sql/sql_select.cc:4674
            #31 0x0000561b95888ebb in mysql_select (thd=thd@entry=0x14b46c000d48, tables=<optimized out>, fields=@0x14b46c013510: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b46c0151c0, last = 0x14b46c0151c0, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x14b46c015b88, unit=0x14b46c004f90, select_lex=0x14b46c013250) at /test/11.1_dbg/sql/sql_select.cc:5155
            #32 0x0000561b95889641 in handle_select (thd=thd@entry=0x14b46c000d48, lex=lex@entry=0x14b46c004eb8, result=result@entry=0x14b46c015b88, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/11.1_dbg/sql/sql_select.cc:611
            #33 0x0000561b957f0cc5 in execute_sqlcom_select (thd=thd@entry=0x14b46c000d48, all_tables=0x14b46c013d28) at /test/11.1_dbg/sql/sql_parse.cc:6024
            #34 0x0000561b957fcefe in mysql_execute_command (thd=thd@entry=0x14b46c000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.1_dbg/sql/sql_parse.cc:3944
            #35 0x0000561b957eb17c in mysql_parse (thd=thd@entry=0x14b46c000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14b4c4ea72f0) at /test/11.1_dbg/sql/sql_parse.cc:7760
            #36 0x0000561b957f8718 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14b46c000d48, packet=packet@entry=0x14b46c00ae39 "", packet_length=packet_length@entry=64, blocking=blocking@entry=true) at /test/11.1_dbg/sql/sql_class.h:1370
            #37 0x0000561b957fab54 in do_command (thd=0x14b46c000d48, blocking=blocking@entry=true) at /test/11.1_dbg/sql/sql_parse.cc:1405
            #38 0x0000561b9595d9c1 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x561b97ec7198, put_in_cache=put_in_cache@entry=true) at /test/11.1_dbg/sql/sql_connect.cc:1416
            #39 0x0000561b9595de90 in handle_one_connection (arg=0x561b97ec7198) at /test/11.1_dbg/sql/sql_connect.cc:1318
            #40 0x000014b4deb45609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #41 0x000014b4de731133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            ramesh Ramesh Sivaraman added a comment - CREATE TABLE t (a TIMESTAMP ); INSERT INTO t VALUES (now()); SELECT ( SELECT * FROM t GROUP BY a WITH ROLLUP HAVING a IS NULL ); Leads to slightly different stack. 0|SIGABRT|Item::val_native|Item::val_native_result|Type_handler_timestamp_common::Item_val_native_with_conversion_result|Item::val_native_with_conversion_result 11.1.0 2b61ff8f2221745f0a96855a0feb0825c426f993 (Debug) mariadbd: /test/11.1_dbg/sql/item.h:1583: virtual bool Item::val_native(THD*, Native*): Assertion `0' failed. 11.1.0 2b61ff8f2221745f0a96855a0feb0825c426f993 (Debug) Core was generated by `/test/MD040423-mariadb-11.1.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --cor'. 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 0x14b4c4ea8700 (LWP 3546026))] (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x000014b4de634859 in __GI_abort () at abort.c:79 #2 0x000014b4de634729 in __assert_fail_base (fmt=0x14b4de7ca588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x561b96560ff1 "0", file=0x561b9638b6d5 "/test/11.1_dbg/sql/item.h", line=1583, function=<optimized out>) at assert.c:92 #3 0x000014b4de645fd6 in __GI___assert_fail (assertion=assertion@entry=0x561b96560ff1 "0", file=file@entry=0x561b9638b6d5 "/test/11.1_dbg/sql/item.h", line=line@entry=1583, function=function@entry=0x561b9638b808 "virtual bool Item::val_native(THD*, Native*)") at assert.c:101 #4 0x0000561b956d46df in Item::val_native (this=0x14b46c0686e8, thd=<optimized out>, to=<optimized out>) at /test/11.1_dbg/sql/item.h:1583 #5 0x0000561b956d3d5d in Item::val_native_result (this=<optimized out>, thd=<optimized out>, to=<optimized out>) at /test/11.1_dbg/sql/item.h:1588 #6 0x0000561b95a10931 in Type_handler_timestamp_common::Item_val_native_with_conversion_result (this=0x561b96da4d50 <type_handler_timestamp2>, thd=0x14b46c000d48, item=0x14b46c0686e8, to=0x14b46c016f08) at /test/11.1_dbg/sql/sql_type.cc:9063 #7 0x0000561b95afe531 in Item::val_native_with_conversion_result (th=0x561b96da4d50 <type_handler_timestamp2>, to=0x14b46c016f08, thd=<optimized out>, this=0x14b46c0686e8) at /test/11.1_dbg/sql/item.h:1547 #8 Item_cache_timestamp::cache_value (this=0x14b46c016e68) at /test/11.1_dbg/sql/item.cc:10383 #9 0x0000561b95bf5cd2 in Item_singlerow_subselect::store (this=this@entry=0x14b46c014ff0, i=i@entry=0, item=<optimized out>) at /test/11.1_dbg/sql/item_subselect.cc:1298 #10 0x0000561b95786d3c in select_singlerow_subselect::send_data (this=<optimized out>, items=<optimized out>) at /test/11.1_dbg/sql/sql_class.cc:3654 #11 0x0000561b95876a6b in select_result_sink::send_data_with_check (sent=<optimized out>, u=<optimized out>, items=<optimized out>, this=<optimized out>) at /test/11.1_dbg/sql/sql_class.h:5748 #12 JOIN::rollup_send_data (this=this@entry=0x14b46c0164c8, idx=idx@entry=0) at /test/11.1_dbg/sql/sql_select.cc:28797 #13 0x0000561b95877220 in end_send_group (join=0x14b46c0164c8, join_tab=<optimized out>, end_of_records=<optimized out>) at /test/11.1_dbg/sql/sql_select.cc:24476 #14 0x0000561b95852744 in sub_select (join=0x14b46c0164c8, join_tab=0x14b46c067650, end_of_records=true) at /test/11.1_dbg/sql/sql_select.cc:22970 #15 0x0000561b9588aaba in do_select (procedure=<optimized out>, join=0x14b46c0164c8) at /test/11.1_dbg/sql/sql_select.cc:22571 #16 JOIN::exec_inner (this=this@entry=0x14b46c0164c8) at /test/11.1_dbg/sql/sql_select.cc:4897 #17 0x0000561b9588afae in JOIN::exec (this=0x14b46c0164c8) at /test/11.1_dbg/sql/sql_select.cc:4674 #18 0x0000561b95bf3c40 in subselect_single_select_engine::exec (this=0x14b46c015180) at /test/11.1_dbg/sql/item_subselect.cc:4159 #19 0x0000561b95bf328e in Item_subselect::exec (this=0x14b46c014ff0) at /test/11.1_dbg/sql/item_subselect.cc:812 #20 0x0000561b95bf1c83 in Item_singlerow_subselect::val_native (this=0x14b46c014ff0, thd=0x14b46c000d48, to=0x14b4c4ea5f30) at /test/11.1_dbg/sql/item_subselect.cc:1503 #21 0x0000561b95a10a97 in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (this=0x14b4c4ea5f30, thd=0x14b46c000d48, item=0x14b46c014ff0, conv=<optimized out>) at /test/11.1_dbg/sql/sql_type.cc:9091 #22 0x0000561b95a12270 in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (item=0x14b46c014ff0, thd=<optimized out>, this=0x14b4c4ea5f30) at /test/11.1_dbg/sql/sql_type.h:2889 #23 Type_handler::Item_send_timestamp (this=<optimized out>, item=0x14b46c014ff0, protocol=0x14b46c001358, buf=0x14b4c4ea5fe0) at /test/11.1_dbg/sql/sql_type.cc:7519 #24 0x0000561b9594a957 in Type_handler_timestamp_common::Item_send (this=<optimized out>, item=<optimized out>, protocol=<optimized out>, buf=<optimized out>) at /test/11.1_dbg/sql/sql_type.h:6642 #25 0x0000561b956d3c48 in Item::send (this=0x14b46c014ff0, protocol=0x14b46c001358, buffer=0x14b4c4ea5fe0) at /test/11.1_dbg/sql/item.h:1235 #26 0x0000561b9570af71 in Protocol::send_result_set_row (this=this@entry=0x14b46c001358, row_items=row_items@entry=0x14b46c013510) at /test/11.1_dbg/sql/protocol.cc:1332 #27 0x0000561b95793441 in select_send::send_data (this=0x14b46c015b88, items=@0x14b46c013510: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b46c0151c0, last = 0x14b46c0151c0, elements = 1}, <No data fields>}) at /test/11.1_dbg/sql/sql_class.cc:3102 #28 0x0000561b95889fbe in select_result_sink::send_data_with_check (sent=0, u=<optimized out>, items=<optimized out>, this=<optimized out>) at /test/11.1_dbg/sql/sql_class.h:5748 #29 JOIN::exec_inner (this=this@entry=0x14b46c015bb0) at /test/11.1_dbg/sql/sql_select.cc:4763 #30 0x0000561b9588afae in JOIN::exec (this=this@entry=0x14b46c015bb0) at /test/11.1_dbg/sql/sql_select.cc:4674 #31 0x0000561b95888ebb in mysql_select (thd=thd@entry=0x14b46c000d48, tables=<optimized out>, fields=@0x14b46c013510: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b46c0151c0, last = 0x14b46c0151c0, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x14b46c015b88, unit=0x14b46c004f90, select_lex=0x14b46c013250) at /test/11.1_dbg/sql/sql_select.cc:5155 #32 0x0000561b95889641 in handle_select (thd=thd@entry=0x14b46c000d48, lex=lex@entry=0x14b46c004eb8, result=result@entry=0x14b46c015b88, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/11.1_dbg/sql/sql_select.cc:611 #33 0x0000561b957f0cc5 in execute_sqlcom_select (thd=thd@entry=0x14b46c000d48, all_tables=0x14b46c013d28) at /test/11.1_dbg/sql/sql_parse.cc:6024 #34 0x0000561b957fcefe in mysql_execute_command (thd=thd@entry=0x14b46c000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.1_dbg/sql/sql_parse.cc:3944 #35 0x0000561b957eb17c in mysql_parse (thd=thd@entry=0x14b46c000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14b4c4ea72f0) at /test/11.1_dbg/sql/sql_parse.cc:7760 #36 0x0000561b957f8718 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14b46c000d48, packet=packet@entry=0x14b46c00ae39 "", packet_length=packet_length@entry=64, blocking=blocking@entry=true) at /test/11.1_dbg/sql/sql_class.h:1370 #37 0x0000561b957fab54 in do_command (thd=0x14b46c000d48, blocking=blocking@entry=true) at /test/11.1_dbg/sql/sql_parse.cc:1405 #38 0x0000561b9595d9c1 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x561b97ec7198, put_in_cache=put_in_cache@entry=true) at /test/11.1_dbg/sql/sql_connect.cc:1416 #39 0x0000561b9595de90 in handle_one_connection (arg=0x561b97ec7198) at /test/11.1_dbg/sql/sql_connect.cc:1318 #40 0x000014b4deb45609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #41 0x000014b4de731133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            Roel Roel Van de Paar added a comment - - edited

            SET sql_mode='';
            CREATE TEMPORARY TABLE t (f1 INT PRIMARY KEY) ENGINE=InnoDB;
            CREATE OR REPLACE TABLE t (c INET4);
            DROP TABLE t;
            INSERT INTO t VALUES (1);
            SELECT (SELECT * FROM t GROUP BY c WITH ROLLUP HAVING c IS NULL);
            

            Leads to

            0|SIGABRT|Item::val_native|Item::val_native_result|Type_handler_fbt<Inet4, Type_collection_fbt<Inet4> >::Item_val_native_with_conversion_result|Item::val_native_with_conversion_result
            0|SIGABRT|Item::val_native|Item::val_native_result|Type_handler_fbt<Inet4, Type_collection_inet>::Item_val_native_with_conversion_result|Item::val_native_with_conversion_result
            

            Confirmed present in 10.11-11.7 (active versions) debug, this one is not present in earlier versions.

            Roel Roel Van de Paar added a comment - - edited SET sql_mode= '' ; CREATE TEMPORARY TABLE t (f1 INT PRIMARY KEY ) ENGINE=InnoDB; CREATE OR REPLACE TABLE t (c INET4); DROP TABLE t; INSERT INTO t VALUES (1); SELECT ( SELECT * FROM t GROUP BY c WITH ROLLUP HAVING c IS NULL ); Leads to 0|SIGABRT|Item::val_native|Item::val_native_result|Type_handler_fbt<Inet4, Type_collection_fbt<Inet4> >::Item_val_native_with_conversion_result|Item::val_native_with_conversion_result 0|SIGABRT|Item::val_native|Item::val_native_result|Type_handler_fbt<Inet4, Type_collection_inet>::Item_val_native_with_conversion_result|Item::val_native_with_conversion_result Confirmed present in 10.11-11.7 (active versions) debug, this one is not present in earlier versions.

            People

              bar Alexander Barkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.