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

Possibly wrong result or Assertion `args[0]->type_handler()->mysql_timestamp_type() == MYSQL_TIMESTAMP_DATETIME' failed in Item_func_round::date_op

    XMLWordPrintable

    Details

      Description

      CREATE TABLE t1 (a DATETIME);
      INSERT INTO t1 VALUES ('1979-01-03 10:33:32'),('2012-12-12 12:12:12');
      SELECT ROUND(a) AS f FROM t1 GROUP BY a WITH ROLLUP;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 0339cbe2

      mysqld: /data/src/10.4/sql/item_func.cc:2559: virtual bool Item_func_round::date_op(THD*, MYSQL_TIME*, date_mode_t): Assertion `args[0]->type_handler()->mysql_timestamp_type() == MYSQL_TIMESTAMP_DATETIME' failed.
      191105 18:11:56 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f941c44df12 in __GI___assert_fail (assertion=0x55b8936b51e0 "args[0]->type_handler()->mysql_timestamp_type() == MYSQL_TIMESTAMP_DATETIME", file=0x55b8936b4e28 "/data/src/10.4/sql/item_func.cc", line=2559, function=0x55b8936b6e60 <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  0x000055b892c0c6b6 in Item_func_round::date_op (this=0x7f9404013848, thd=0x7f9404000af0, to=0x7f941661d8c8, fuzzydate=...) at /data/src/10.4/sql/item_func.cc:2558
      #9  0x000055b892a3ce1b in Type_handler_temporal_result::Item_func_hybrid_field_type_get_date (this=0x55b893fbbc20 <type_handler_datetime2>, thd=0x7f9404000af0, item=0x7f9404013848, warn=0x7f941661d520, ltime=0x7f941661d8c8, fuzzydate=...) at /data/src/10.4/sql/sql_type.cc:4867
      #10 0x000055b892a3bc72 in Type_handler::Item_func_hybrid_field_type_get_date_with_warn (this=0x55b893fbbc20 <type_handler_datetime2>, thd=0x7f9404000af0, item=0x7f9404013848, ltime=0x7f941661d8c8, mode=...) at /data/src/10.4/sql/sql_type.cc:4451
      #11 0x000055b8928021f6 in Item_func_hybrid_field_type::get_date (this=0x7f9404013848, thd=0x7f9404000af0, to=0x7f941661d8c8, mode=...) at /data/src/10.4/sql/item_func.h:777
      #12 0x000055b892a417b7 in Type_handler::Item_send_datetime (this=0x55b893fbbc20 <type_handler_datetime2>, item=0x7f9404013848, protocol=0x7f94040010b8, buf=0x7f941661d8c0) at /data/src/10.4/sql/sql_type.cc:6844
      #13 0x000055b892a4ed96 in Type_handler_datetime_common::Item_send (this=0x55b893fbbc20 <type_handler_datetime2>, item=0x7f9404013848, protocol=0x7f94040010b8, buf=0x7f941661d8c0) at /data/src/10.4/sql/sql_type.h:5515
      #14 0x000055b8926fb502 in Item::send (this=0x7f9404013848, protocol=0x7f94040010b8, buffer=0x7f941661d8c0) at /data/src/10.4/sql/item.h:1034
      #15 0x000055b8926f564d in Protocol::send_result_set_row (this=0x7f94040010b8, row_items=0x7f94040151b0) at /data/src/10.4/sql/protocol.cc:1035
      #16 0x000055b8927aa4a8 in select_send::send_data (this=0x7f9404014a80, items=...) at /data/src/10.4/sql/sql_class.cc:3002
      #17 0x000055b8928abac9 in JOIN::rollup_send_data (this=0x7f9404014aa8, idx=0) at /data/src/10.4/sql/sql_select.cc:25728
      #18 0x000055b8928a0d17 in end_send_group (join=0x7f9404014aa8, join_tab=0x7f9404016328, end_of_records=true) at /data/src/10.4/sql/sql_select.cc:21534
      #19 0x000055b89289d232 in sub_select (join=0x7f9404014aa8, join_tab=0x7f9404015f80, end_of_records=true) at /data/src/10.4/sql/sql_select.cc:20137
      #20 0x000055b89289c95b in do_select (join=0x7f9404014aa8, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19728
      #21 0x000055b892871a61 in JOIN::exec_inner (this=0x7f9404014aa8) at /data/src/10.4/sql/sql_select.cc:4386
      #22 0x000055b892870b9e in JOIN::exec (this=0x7f9404014aa8) at /data/src/10.4/sql/sql_select.cc:4168
      #23 0x000055b8928722b3 in mysql_select (thd=0x7f9404000af0, tables=0x7f9404013970, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f9404014150, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f9404014a80, unit=0x7f9404004a20, select_lex=0x7f9404013208) at /data/src/10.4/sql/sql_select.cc:4600
      #24 0x000055b892862224 in handle_select (thd=0x7f9404000af0, lex=0x7f9404004958, result=0x7f9404014a80, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:420
      #25 0x000055b892828a1c in execute_sqlcom_select (thd=0x7f9404000af0, all_tables=0x7f9404013970) at /data/src/10.4/sql/sql_parse.cc:6357
      #26 0x000055b89281e103 in mysql_execute_command (thd=0x7f9404000af0) at /data/src/10.4/sql/sql_parse.cc:3899
      #27 0x000055b89282cb29 in mysql_parse (thd=0x7f9404000af0, rawbuf=0x7f9404013138 "SELECT ROUND(a) AS f FROM t1 GROUP BY a WITH ROLLUP", length=51, parser_state=0x7f941661f170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7898
      #28 0x000055b892817d06 in dispatch_command (command=COM_QUERY, thd=0x7f9404000af0, packet=0x7f9404008341 "", packet_length=51, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #29 0x000055b892816393 in do_command (thd=0x7f9404000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #30 0x000055b89299e241 in do_handle_one_connection (connect=0x55b8960b5e60) at /data/src/10.4/sql/sql_connect.cc:1412
      #31 0x000055b89299df90 in handle_one_connection (arg=0x55b8960b5e60) at /data/src/10.4/sql/sql_connect.cc:1316
      #32 0x000055b8933a1723 in pfs_spawn_thread (arg=0x55b895fda6c0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #33 0x00007f941dfc34a4 in start_thread (arg=0x7f9416620700) at pthread_create.c:456
      #34 0x00007f941c50ad0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Not reproducible on 10.3.

      Non-debug 10.4 returns a different result comparing to 10.3, I don't know which is correct:

      10.4

      SELECT ROUND(a) AS f FROM t1 GROUP BY a WITH ROLLUP;
      f
      1979-01-03 10:33:32
      2012-12-12 12:12:12
      NULL
      

      10.3

      SELECT ROUND(a) AS f FROM t1 GROUP BY a WITH ROLLUP;
      f
      19790103103332
      20121212121212
      NULL
      

        Attachments

          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