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

Wrong result or Assertion `0' in Item::val_native / Type_handler_inet6::Item_val_native_with_conversion

    XMLWordPrintable

    Details

      Description

      CREATE TABLE t1 (a INET6);
      INSERT INTO t1 VALUES ('::'),('::');
      SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '';
       
      # Cleanup
      DROP TABLE t1;
      

      10.5 7c052cdf non-debug - Actual result

      SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '';
      f
      

      Expected result

      SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '';
      f
      ::
      

      10.5 7c052cdf debug

      mariadbd: /data/src/10.5/sql/item.h:1371: virtual bool Item::val_native(THD*, Native*): Assertion `0' failed.
      210118 20:12:49 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fa746684f36 in __GI___assert_fail (assertion=0x5635102ec20f "0", file=0x5635102ec173 "/data/src/10.5/sql/item.h", line=1371, function=0x5635102ec2d0 "virtual bool Item::val_native(THD*, Native*)") at assert.c:101
      #8  0x000056350f41a104 in Item::val_native (this=0x7fa730017cc0, thd=0x7fa730000db8, to=0x7fa730015320) at /data/src/10.5/sql/item.h:1371
      #9  0x000056350f5e9b09 in Item::val_native_from_item (this=0x7fa730015030, thd=0x7fa730000db8, item=0x7fa730017cc0, to=0x7fa730015320) at /data/src/10.5/sql/item.h:878
      #10 0x000056350f8f049c in Item_ref::val_native (this=0x7fa730015030, thd=0x7fa730000db8, to=0x7fa730015320) at /data/src/10.5/sql/item.cc:8339
      #11 0x00005635102a1c2e in Type_handler_inet6::Item_val_native_with_conversion (this=0x5635117c09d0 <type_handler_inet6>, thd=0x7fa730000db8, item=0x7fa730015030, to=0x7fa730015320) at /data/src/10.5/plugin/type_inet/sql_type_inet.h:775
      #12 0x000056350f823858 in Item::val_native_with_conversion (this=0x7fa730015030, thd=0x7fa730000db8, to=0x7fa730015320, th=0x5635117c09d0 <type_handler_inet6>) at /data/src/10.5/sql/item.h:1330
      #13 0x000056350f90487e in Arg_comparator::compare_native (this=0x7fa7300152c0) at /data/src/10.5/sql/item_cmpfunc.cc:802
      #14 0x000056350f91dc94 in Arg_comparator::compare (this=0x7fa7300152c0) at /data/src/10.5/sql/item_cmpfunc.h:102
      #15 0x000056350f907f96 in Item_func_ne::val_int (this=0x7fa7300151f0) at /data/src/10.5/sql/item_cmpfunc.cc:1798
      #16 0x000056350f5d2f3a in end_send_group (join=0x7fa730015d50, join_tab=0x7fa730017548, end_of_records=true) at /data/src/10.5/sql/sql_select.cc:21963
      #17 0x000056350f5cf3f9 in sub_select (join=0x7fa730015d50, join_tab=0x7fa7300171a0, end_of_records=true) at /data/src/10.5/sql/sql_select.cc:20572
      #18 0x000056350f5ceb5e in do_select (join=0x7fa730015d50, procedure=0x0) at /data/src/10.5/sql/sql_select.cc:20163
      #19 0x000056350f5a2602 in JOIN::exec_inner (this=0x7fa730015d50) at /data/src/10.5/sql/sql_select.cc:4462
      #20 0x000056350f5a1723 in JOIN::exec (this=0x7fa730015d50) at /data/src/10.5/sql/sql_select.cc:4242
      #21 0x000056350f5a2de5 in mysql_select (thd=0x7fa730000db8, tables=0x7fa730014840, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7fa730014fd0, having=0x7fa7300151f0, proc_param=0x0, select_options=2147748608, result=0x7fa730015d28, unit=0x7fa730004f58, select_lex=0x7fa730014010) at /data/src/10.5/sql/sql_select.cc:4658
      #22 0x000056350f592a33 in handle_select (thd=0x7fa730000db8, lex=0x7fa730004e90, result=0x7fa730015d28, setup_tables_done_option=0) at /data/src/10.5/sql/sql_select.cc:417
      #23 0x000056350f555409 in execute_sqlcom_select (thd=0x7fa730000db8, all_tables=0x7fa730014840) at /data/src/10.5/sql/sql_parse.cc:6281
      #24 0x000056350f54c495 in mysql_execute_command (thd=0x7fa730000db8) at /data/src/10.5/sql/sql_parse.cc:3977
      #25 0x000056350f55a2b0 in mysql_parse (thd=0x7fa730000db8, rawbuf=0x7fa730013f30 "SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != ''", length=64, parser_state=0x7fa74103f510, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:8062
      #26 0x000056350f546237 in dispatch_command (command=COM_QUERY, thd=0x7fa730000db8, packet=0x7fa7300090a9 "", packet_length=64, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1889
      #27 0x000056350f544a2b in do_command (thd=0x7fa730000db8) at /data/src/10.5/sql/sql_parse.cc:1370
      #28 0x000056350f6f272b in do_handle_one_connection (connect=0x5635125f6848, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1410
      #29 0x000056350f6f248e in handle_one_connection (arg=0x563512663208) at /data/src/10.5/sql/sql_connect.cc:1312
      #30 0x000056350fc513fb in pfs_spawn_thread (arg=0x5635125f6488) at /data/src/10.5/storage/perfschema/pfs.cc:2201
      #31 0x00007fa746b9c609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #32 0x00007fa746770293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Could not reproduce the assertion failure with VARBINARY or CHAR(39) instead of INET6; thus the test case is not applicable to previous versions.
      On a non-debug version, the test case with INET6 produces the wrong result, while the same test case with CHAR(39) returns the expected result.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration