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

Assertion `0' failed in Item_cache_timestamp::val_datetime_packed / Predicant_to_list_comparator::cmp_arg

    Details

      Description

      Note: Same assertion failure as in MDEV-18240, but very different stack trace, filing separately just in case.

      CREATE TABLE t1 (t TIMESTAMP DEFAULT '1971-01-01 00:00:00', f INT);
      INSERT INTO t1 VALUES ('1978-05-25 22:25:03',1),('2000-01-01 00:00:00',2);
      SELECT * FROM t1 WHERE f IN ( DEFAULT(t), 1 );
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 a081a998

      mysqld: /data/src/10.4/sql/item.h:6759: virtual longlong Item_cache_timestamp::val_datetime_packed(THD*): Assertion `0' failed.
      190215 20:23:03 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f456d2c7ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000557ac584f19c in Item_cache_timestamp::val_datetime_packed (this=0x7f454c0192a0, thd=0x7f454c000b00) at /data/src/10.4/sql/item.h:6759
      #9  0x0000557ac58617cd in cmp_item_datetime::cmp (this=0x7f454c0175f8, arg=0x7f454c0192a0) at /data/src/10.4/sql/item_cmpfunc.cc:4164
      #10 0x0000557ac586e634 in Predicant_to_list_comparator::cmp_arg (this=0x7f454c016318, args=0x7f454c0162b8, i=0) at /data/src/10.4/sql/item_cmpfunc.h:1938
      #11 0x0000557ac586eeb4 in Predicant_to_list_comparator::cmp (this=0x7f454c016318, args=0x7f454c0162b8, idx=0x7f45683e5dac, found_unknown_values=0x7f454c0162a6) at /data/src/10.4/sql/item_cmpfunc.h:2114
      #12 0x0000557ac5862fe5 in Item_func_in::val_int (this=0x7f454c016230) at /data/src/10.4/sql/item_cmpfunc.cc:4657
      #13 0x0000557ac5548bea in evaluate_join_record (join=0x7f454c016c00, join_tab=0x7f454c018950, error=0) at /data/src/10.4/sql/sql_select.cc:19756
      #14 0x0000557ac55487fd in sub_select (join=0x7f454c016c00, join_tab=0x7f454c018950, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:19661
      #15 0x0000557ac5547d37 in do_select (join=0x7f454c016c00, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19201
      #16 0x0000557ac551f3fd in JOIN::exec_inner (this=0x7f454c016c00) at /data/src/10.4/sql/sql_select.cc:4153
      #17 0x0000557ac551e614 in JOIN::exec (this=0x7f454c016c00) at /data/src/10.4/sql/sql_select.cc:3941
      #18 0x0000557ac551fb6d in mysql_select (thd=0x7f454c000b00, tables=0x7f454c0157e0, wild_num=1, fields=..., conds=0x7f454c016230, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f454c016bd8, unit=0x7f454c0049f0, select_lex=0x7f454c015258) at /data/src/10.4/sql/sql_select.cc:4352
      #19 0x0000557ac5510f7c in handle_select (thd=0x7f454c000b00, lex=0x7f454c004928, result=0x7f454c016bd8, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:423
      #20 0x0000557ac54da625 in execute_sqlcom_select (thd=0x7f454c000b00, all_tables=0x7f454c0157e0) at /data/src/10.4/sql/sql_parse.cc:6576
      #21 0x0000557ac54cf8d3 in mysql_execute_command (thd=0x7f454c000b00) at /data/src/10.4/sql/sql_parse.cc:3813
      #22 0x0000557ac54de570 in mysql_parse (thd=0x7f454c000b00, rawbuf=0x7f454c015198 "SELECT * FROM t1 WHERE f IN ( DEFAULT(t), 1 )", length=45, parser_state=0x7f45683e7210, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8129
      #23 0x0000557ac54c9cbc in dispatch_command (command=COM_QUERY, thd=0x7f454c000b00, packet=0x7f454c00a461 "", packet_length=45, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1808
      #24 0x0000557ac54c85c8 in do_command (thd=0x7f454c000b00) at /data/src/10.4/sql/sql_parse.cc:1358
      #25 0x0000557ac563a828 in do_handle_one_connection (connect=0x557ac95adee0) at /data/src/10.4/sql/sql_connect.cc:1399
      #26 0x0000557ac563a599 in handle_one_connection (arg=0x557ac95adee0) at /data/src/10.4/sql/sql_connect.cc:1302
      #27 0x0000557ac5b29e75 in pfs_spawn_thread (arg=0x557ac95e74c0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #28 0x00007f456ef9e494 in start_thread (arg=0x7f45683e8700) at pthread_create.c:333
      #29 0x00007f456d38493f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Not reproducible on 10.3.
      No obvious problems on a non-debug build apart from questionable warnings, but they are present in all versions and apparently are there by design

      SELECT * FROM t1 WHERE f IN ( DEFAULT(t), 1 );
      t	f
      1978-05-25 22:25:03	1
      Warnings:
      Warning	1292	Incorrect datetime value: '1' for column `test`.`t1`.`f` at row 1
      Warning	1292	Incorrect datetime value: '2' for column `test`.`t1`.`f` at row 2
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: