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

Assertion `is_null() == item->null_value || conv' failed in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null upon query with GROUP BY

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (t TIMESTAMP);
      INSERT INTO t1 () VALUES (),();
       
      SELECT IF(0,t,NULL) AS f FROM t1 GROUP BY 'foo';
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 a8eb0c76bf

      mysqld: /data/src/10.4/sql/sql_type.cc:8159: Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null(THD*, Item*, bool): Assertion `is_null() == item->null_value || conv' failed.
      181224 13:45:49 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f4b09bf8ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x00005600148298ba in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (this=0x7f4b04589f30, thd=0x7f4ae8000b00, item=0x7f4ae8018568, conv=false) at /data/src/10.4/sql/sql_type.cc:8159
      #9  0x000056001482d555 in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (this=0x7f4b04589f30, thd=0x7f4ae8000b00, item=0x7f4ae8018568) at /data/src/10.4/sql/sql_type.h:2457
      #10 0x00005600148242bf in Type_handler::Item_send_timestamp (this=0x560015c3a2b0 <type_handler_timestamp2>, item=0x7f4ae8018568, protocol=0x7f4ae80010c0, buf=0x7f4b0458a040) at /data/src/10.4/sql/sql_type.cc:6703
      #11 0x00005600148307b4 in Type_handler_timestamp_common::Item_send (this=0x560015c3a2b0 <type_handler_timestamp2>, item=0x7f4ae8018568, protocol=0x7f4ae80010c0, buf=0x7f4b0458a040) at /data/src/10.4/sql/sql_type.h:5465
      #12 0x000056001451b56a in Item::send (this=0x7f4ae8018568, protocol=0x7f4ae80010c0, buffer=0x7f4b0458a040) at /data/src/10.4/sql/item.h:1032
      #13 0x0000560014515fe8 in Protocol::send_result_set_row (this=0x7f4ae80010c0, row_items=0x7f4ae8016b78) at /data/src/10.4/sql/protocol.cc:986
      #14 0x00005600145c0738 in select_send::send_data (this=0x7f4ae80167a0, items=...) at /data/src/10.4/sql/sql_class.cc:2949
      #15 0x00005600146a1fa0 in end_send_group (join=0x7f4ae80167c8, join_tab=0x7f4ae8017de8, end_of_records=true) at /data/src/10.4/sql/sql_select.cc:20718
      #16 0x000056001469e6e1 in sub_select (join=0x7f4ae80167c8, join_tab=0x7f4ae8017a38, end_of_records=true) at /data/src/10.4/sql/sql_select.cc:19341
      #17 0x000056001469dea9 in do_select (join=0x7f4ae80167c8, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:18932
      #18 0x00005600146768a3 in JOIN::exec_inner (this=0x7f4ae80167c8) at /data/src/10.4/sql/sql_select.cc:4094
      #19 0x0000560014675ce4 in JOIN::exec (this=0x7f4ae80167c8) at /data/src/10.4/sql/sql_select.cc:3888
      #20 0x0000560014676fa3 in mysql_select (thd=0x7f4ae8000b00, tables=0x7f4ae8015800, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f4ae8015ef0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f4ae80167a0, unit=0x7f4ae80049c0, select_lex=0x7f4ae8015058) at /data/src/10.4/sql/sql_select.cc:4293
      #21 0x00005600146688af in handle_select (thd=0x7f4ae8000b00, lex=0x7f4ae80048f8, result=0x7f4ae80167a0, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:385
      #22 0x0000560014632ad9 in execute_sqlcom_select (thd=0x7f4ae8000b00, all_tables=0x7f4ae8015800) at /data/src/10.4/sql/sql_parse.cc:6567
      #23 0x00005600146290d4 in mysql_execute_command (thd=0x7f4ae8000b00) at /data/src/10.4/sql/sql_parse.cc:3776
      #24 0x00005600146368e4 in mysql_parse (thd=0x7f4ae8000b00, rawbuf=0x7f4ae8014f98 "SELECT IF(0,t,NULL) AS f FROM t1 GROUP BY 'foo'", length=47, parser_state=0x7f4b0458b600, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8104
      #25 0x0000560014623b0e in dispatch_command (command=COM_QUERY, thd=0x7f4ae8000b00, packet=0x7f4ae800b421 "", packet_length=47, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1851
      #26 0x0000560014622532 in do_command (thd=0x7f4ae8000b00) at /data/src/10.4/sql/sql_parse.cc:1396
      #27 0x000056001478e6de in do_handle_one_connection (connect=0x560016ad16b0) at /data/src/10.4/sql/sql_connect.cc:1402
      #28 0x000056001478e462 in handle_one_connection (arg=0x560016ad16b0) at /data/src/10.4/sql/sql_connect.cc:1308
      #29 0x0000560014c4d338 in pfs_spawn_thread (arg=0x560016a15970) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #30 0x00007f4b0b6b4494 in start_thread (arg=0x7f4b0458c700) at pthread_create.c:333
      #31 0x00007f4b09cb593f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Non-debug build doesn't crash, but the result is questionable:

      SELECT IF(0,t,NULL) AS f FROM t1 GROUP BY 'foo';
      f
      0000-00-00 00:00:00
      

      10.3 produces NULL.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.