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

Assertion `maybe_null || !null_value' failed in Item_func_round::date_op

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (t TIMESTAMP NOT NULL) ENGINE=MyISAM;
      SELECT * FROM t1 WHERE TRUNCATE( t, 1 );
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 18af13b8 debug

      mysqld: /data/src/10.4/sql/item_func.cc:2541: virtual bool Item_func_round::date_op(THD*, MYSQL_TIME*, date_mode_t): Assertion `maybe_null || !null_value' failed.
      190905  0:29:29 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fc204df7f12 in __GI___assert_fail (assertion=0x5652573e4fd0 "maybe_null || !null_value", file=0x5652573e4c28 "/data/src/10.4/sql/item_func.cc", line=2541, function=0x5652573e6c60 <Item_func_round::date_op(THD*, st_mysql_time*, date_mode_t)::__PRETTY_FUNCTION__> "virtual bool Item_func_round::date_op(THD*, MYSQL_TIME*, date_mode_t)") at assert.c:101
      #8  0x000056525690d62b in Item_func_round::date_op (this=0x7fc1e4014000, thd=0x7fc1e4000b00, to=0x7fc1fafc0ac0, fuzzydate=...) at /data/src/10.4/sql/item_func.cc:2541
      #9  0x000056525691e3d2 in Item_func_hybrid_field_type::date_op_with_null_check (this=0x7fc1e4014000, thd=0x7fc1e4000b00, ltime=0x7fc1fafc0ac0) at /data/src/10.4/sql/item_func.h:675
      #10 0x0000565256906155 in Item_func_hybrid_field_type::val_real_from_date_op (this=0x7fc1e4014000) at /data/src/10.4/sql/item_func.cc:864
      #11 0x000056525673a568 in Type_handler_temporal_result::Item_func_hybrid_field_type_val_real (this=0x565257ce5c20 <type_handler_datetime2>, item=0x7fc1e4014000) at /data/src/10.4/sql/sql_type.cc:4794
      #12 0x00005652564fb7bb in Item_func_hybrid_field_type::val_real (this=0x7fc1e4014000) at /data/src/10.4/sql/item_func.h:751
      #13 0x000056525673919b in Type_handler_temporal_result::Item_val_bool (this=0x565257ce5c20 <type_handler_datetime2>, item=0x7fc1e4014000) at /data/src/10.4/sql/sql_type.cc:4378
      #14 0x00005652563f3038 in Item::val_bool (this=0x7fc1e4014000) at /data/src/10.4/sql/item.h:1458
      #15 0x00005652565b0ffb in Item::eval_const_cond (this=0x7fc1e4014000) at /data/src/10.4/sql/item.h:1466
      #16 0x000056525658edfe in Item::remove_eq_conds (this=0x7fc1e4014000, thd=0x7fc1e4000b00, cond_value=0x7fc1e4014d60, top_level_arg=true) at /data/src/10.4/sql/sql_select.cc:17209
      #17 0x000056525656e874 in make_join_statistics (join=0x7fc1e4014a50, tables_list=..., keyuse_array=0x7fc1e4014d40) at /data/src/10.4/sql/sql_select.cc:5241
      #18 0x0000565256563849 in JOIN::optimize_inner (this=0x7fc1e4014a50) at /data/src/10.4/sql/sql_select.cc:2193
      #19 0x0000565256561426 in JOIN::optimize (this=0x7fc1e4014a50) at /data/src/10.4/sql/sql_select.cc:1562
      #20 0x000056525656c64e in mysql_select (thd=0x7fc1e4000b00, tables=0x7fc1e4013788, wild_num=1, fields=..., conds=0x7fc1e4014000, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fc1e4014a28, unit=0x7fc1e4004a30, select_lex=0x7fc1e40131c8) at /data/src/10.4/sql/sql_select.cc:4591
      #21 0x000056525655c4c7 in handle_select (thd=0x7fc1e4000b00, lex=0x7fc1e4004968, result=0x7fc1e4014a28, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:425
      #22 0x00005652565227a2 in execute_sqlcom_select (thd=0x7fc1e4000b00, all_tables=0x7fc1e4013788) at /data/src/10.4/sql/sql_parse.cc:6357
      #23 0x0000565256517d4c in mysql_execute_command (thd=0x7fc1e4000b00) at /data/src/10.4/sql/sql_parse.cc:3899
      #24 0x00005652565268ec in mysql_parse (thd=0x7fc1e4000b00, rawbuf=0x7fc1e4013118 "SELECT * FROM t1 WHERE TRUNCATE( t, 1 )", length=39, parser_state=0x7fc1fafc2170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7909
      #25 0x00005652565118ec in dispatch_command (command=COM_QUERY, thd=0x7fc1e4000b00, packet=0x7fc1e4008321 "SELECT * FROM t1 WHERE TRUNCATE( t, 1 )", packet_length=39, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1843
      #26 0x000056525650ff36 in do_command (thd=0x7fc1e4000b00) at /data/src/10.4/sql/sql_parse.cc:1360
      #27 0x0000565256699c47 in do_handle_one_connection (connect=0x565259474f20) at /data/src/10.4/sql/sql_connect.cc:1412
      #28 0x0000565256699996 in handle_one_connection (arg=0x565259474f20) at /data/src/10.4/sql/sql_connect.cc:1316
      #29 0x00005652570cfda3 in pfs_spawn_thread (arg=0x5652594aa330) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #30 0x00007fc20696c4a4 in start_thread (arg=0x7fc1fafc3700) at pthread_create.c:456
      #31 0x00007fc204eb4d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      A similar crash happens with these scripts:

      CREATE OR REPLACE TABLE t1 (t TIMESTAMP NOT NULL) ENGINE=MyISAM;
      SELECT * FROM t1 WHERE TRUNCATE( t, 1 ) = '2001-01-01 10:20:30';
      

      CREATE OR REPLACE TABLE t1 (t TIMESTAMP NOT NULL) ENGINE=MyISAM;
      SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE TRUNCATE(t,1));
      

      CREATE OR REPLACE TABLE t1 (t TIMESTAMP NOT NULL) ENGINE=MyISAM;
      SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE TRUNCATE(t,1)='2001-01-01 10:20:30');
      

      CREATE OR REPLACE TABLE t1 (t TIMESTAMP NOT NULL) ENGINE=MyISAM;
      SELECT * FROM t1 WHERE NOT EXISTS (SELECT * FROM t1 WHERE TRUNCATE(t,1));
      

      CREATE OR REPLACE TABLE t1 (t TIMESTAMP NOT NULL) ENGINE=MyISAM;
      SELECT * FROM t1 WHERE NOT EXISTS (SELECT * FROM t1 WHERE TRUNCATE(t,1)='2001-01-01 10:20:30');
      

      No visible effect on a non-debug build.
      Not reproducible on 10.3 or, oddly, on 10.5.

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              6 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.