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

Assertion `(m_ptr == __null) == item->null_value' failed in VDec::VDec(Item*)

    XMLWordPrintable

    Details

      Description

      CREATE TABLE t1 (a TIMESTAMP(4), b TIMESTAMP DEFAULT 0) ENGINE=MyISAM;
      INSERT IGNORE INTO t1 VALUES ('2001-01-01','2002-01-01'),('2003-01-01','2004-01-01');
      SELECT * FROM t1 WHERE DEFAULT(b) - a;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 9fce9428

      mysqld: /data/src/10.4/sql/sql_type.cc:183: VDec::VDec(Item*): Assertion `(m_ptr == __null) == item->null_value' failed.
      190826  2:03:13 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f2d41348f12 in __GI___assert_fail (assertion=0x561401749ee0 "(m_ptr == __null) == item->null_value", file=0x561401749ec0 "/data/src/10.4/sql/sql_type.cc", line=183, function=0x56140174b0c0 <VDec::VDec(Item*)::__PRETTY_FUNCTION__> "VDec::VDec(Item*)") at assert.c:101
      #8  0x0000561400cdb391 in VDec::VDec (this=0x7f2d374fdb80, item=0x7f2d200171c8) at /data/src/10.4/sql/sql_type.cc:183
      #9  0x0000561400eb32ee in VDec2_lazy::VDec2_lazy (this=0x7f2d374fdb80, a=0x7f2d200171c8, b=0x7f2d20014098) at /data/src/10.4/sql/sql_type.h:280
      #10 0x0000561400e9ee24 in Item_func_minus::decimal_op (this=0x7f2d200141a8, decimal_value=0x7f2d374fdc88) at /data/src/10.4/sql/item_func.cc:1300
      #11 0x0000561400cdb3f5 in VDec_op::VDec_op (this=0x7f2d374fdc80, item=0x7f2d200141a8) at /data/src/10.4/sql/sql_type.cc:189
      #12 0x0000561400ce6c15 in Type_handler_decimal_result::Item_func_hybrid_field_type_val_int (this=0x561402174b50 <type_handler_newdecimal>, item=0x7f2d200141a8) at /data/src/10.4/sql/sql_type.cc:4625
      #13 0x0000561400ac1d0a in Item_func_hybrid_field_type::val_int (this=0x7f2d200141a8) at /data/src/10.4/sql/item_func.h:757
      #14 0x0000561400b57825 in evaluate_join_record (join=0x7f2d20014b78, join_tab=0x7f2d20016888, error=0) at /data/src/10.4/sql/sql_select.cc:20241
      #15 0x0000561400b5744f in sub_select (join=0x7f2d20014b78, join_tab=0x7f2d20016888, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20146
      #16 0x0000561400b5697c in do_select (join=0x7f2d20014b78, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19684
      #17 0x0000561400b2cb7b in JOIN::exec_inner (this=0x7f2d20014b78) at /data/src/10.4/sql/sql_select.cc:4391
      #18 0x0000561400b2bd28 in JOIN::exec (this=0x7f2d20014b78) at /data/src/10.4/sql/sql_select.cc:4173
      #19 0x0000561400b2d3cd in mysql_select (thd=0x7f2d20000b00, tables=0x7f2d20013798, wild_num=1, fields=..., conds=0x7f2d200141a8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f2d20014b50, unit=0x7f2d20004a30, select_lex=0x7f2d200131d8) at /data/src/10.4/sql/sql_select.cc:4605
      #20 0x0000561400b1d9a6 in handle_select (thd=0x7f2d20000b00, lex=0x7f2d20004968, result=0x7f2d20014b50, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:425
      #21 0x0000561400ae6fc5 in execute_sqlcom_select (thd=0x7f2d20000b00, all_tables=0x7f2d20013798) at /data/src/10.4/sql/sql_parse.cc:6356
      #22 0x0000561400adce0c in mysql_execute_command (thd=0x7f2d20000b00) at /data/src/10.4/sql/sql_parse.cc:3898
      #23 0x0000561400aead59 in mysql_parse (thd=0x7f2d20000b00, rawbuf=0x7f2d20013128 "SELECT * FROM t1 WHERE DEFAULT(b) - a", length=37, parser_state=0x7f2d374ff170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7908
      #24 0x0000561400ad7002 in dispatch_command (command=COM_QUERY, thd=0x7f2d20000b00, packet=0x7f2d20008331 "", packet_length=37, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1843
      #25 0x0000561400ad5748 in do_command (thd=0x7f2d20000b00) at /data/src/10.4/sql/sql_parse.cc:1360
      #26 0x0000561400c4f72e in do_handle_one_connection (connect=0x56140335a130) at /data/src/10.4/sql/sql_connect.cc:1404
      #27 0x0000561400c4f47d in handle_one_connection (arg=0x56140335a130) at /data/src/10.4/sql/sql_connect.cc:1306
      #28 0x000056140157c7e9 in pfs_spawn_thread (arg=0x5614032d8390) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #29 0x00007f2d42ebd4a4 in start_thread (arg=0x7f2d37500700) at pthread_create.c:456
      #30 0x00007f2d41405d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      This particular failure appeared after this commit:

      commit c99f9766b11bda7eb15d6875f2f1e64c2d01b461
      Author: Alexander Barkov
      Date:   Mon Aug 5 14:41:17 2019 +0400
       
          MDEV-19166 Assertion `!is_zero_datetime()' failed in Timestamp_or_zero_datetime::tv
      

      It is not a regression as such, before the commit above the test case was also failing, on the assertion which the commit fixes.

      Non-debug build doesn't crash, but it produces an empty result set without any warnings. I don't know if it's the expected outcome. Earlier it was producing a warning per row:

      Warnings:
      Warning	1916	Got overflow when converting '-309999980000' to UNSIGNED INT. Value truncated
      Warning	1916	Got overflow when converting '-329999980000' to UNSIGNED INT. Value truncated
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration