[MDEV-19166] Assertion `!is_zero_datetime()' failed in Timestamp_or_zero_datetime::tv Created: 2019-04-03  Updated: 2019-08-25  Resolved: 2019-08-05

Status: Closed
Project: MariaDB Server
Component/s: Temporal Types
Affects Version/s: 10.4
Fix Version/s: 10.4.8

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-20417 Assertion `(m_ptr == __null) == item-... Closed

 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 (f TIMESTAMP DEFAULT 0) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('2024-02-29');
SELECT * FROM t1 WHERE SUBSTR(1 FROM BIT_LENGTH(f) FOR DEFAULT(f));
 
# Cleanup
DROP TABLE t1;

10.4 0dc442ac

mysqld: /data/src/10.4/sql/sql_type.h:2410: const timeval& Timestamp_or_zero_datetime::tv() const: Assertion `!is_zero_datetime()' failed.
190404  0:27:23 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f0250ee9ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x000055d8b8a00c48 in Timestamp_or_zero_datetime::tv (this=0x7f0246255b90) at /data/src/10.4/sql/sql_type.h:2410
#9  0x000055d8b8b62292 in Item_cache_timestamp::to_datetime (this=0x7f01f8019760, thd=0x7f01f8000b00) at /data/src/10.4/sql/item.cc:9904
#10 0x000055d8b8b68c95 in Item_cache_timestamp::val_int (this=0x7f01f8019760) at /data/src/10.4/sql/item.h:6761
#11 0x000055d8b8bea2f1 in Item_func_substr::val_str (this=0x7f01f8016848, str=0x7f0246255c80) at /data/src/10.4/sql/item_strfunc.cc:1702
#12 0x000055d8b8be4415 in Item_str_func::val_int (this=0x7f01f8016848) at /data/src/10.4/sql/item_strfunc.cc:138
#13 0x000055d8b8863b00 in evaluate_join_record (join=0x7f01f8017220, join_tab=0x7f01f8018de0, error=0) at /data/src/10.4/sql/sql_select.cc:20124
#14 0x000055d8b8863733 in sub_select (join=0x7f01f8017220, join_tab=0x7f01f8018de0, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20029
#15 0x000055d8b8862c61 in do_select (join=0x7f01f8017220, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19567
#16 0x000055d8b88398bd in JOIN::exec_inner (this=0x7f01f8017220) at /data/src/10.4/sql/sql_select.cc:4381
#17 0x000055d8b8838a64 in JOIN::exec (this=0x7f01f8017220) at /data/src/10.4/sql/sql_select.cc:4163
#18 0x000055d8b883a116 in mysql_select (thd=0x7f01f8000b00, tables=0x7f01f8015c90, wild_num=1, fields=..., conds=0x7f01f8016848, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f01f80171f8, unit=0x7f01f8004a30, select_lex=0x7f01f80156d8) at /data/src/10.4/sql/sql_select.cc:4595
#19 0x000055d8b882a610 in handle_select (thd=0x7f01f8000b00, lex=0x7f01f8004968, result=0x7f01f80171f8, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:424
#20 0x000055d8b87f3e53 in execute_sqlcom_select (thd=0x7f01f8000b00, all_tables=0x7f01f8015c90) at /data/src/10.4/sql/sql_parse.cc:6602
#21 0x000055d8b87e9429 in mysql_execute_command (thd=0x7f01f8000b00) at /data/src/10.4/sql/sql_parse.cc:3891
#22 0x000055d8b87f7be4 in mysql_parse (thd=0x7f01f8000b00, rawbuf=0x7f01f80155e8 "SELECT * FROM t1 WHERE SUBSTR(1 FROM BIT_LENGTH(f) FOR DEFAULT(f))", length=66, parser_state=0x7f0246257180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8154
#23 0x000055d8b87e3630 in dispatch_command (command=COM_QUERY, thd=0x7f01f8000b00, packet=0x7f01f800a8a1 "", packet_length=66, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1832
#24 0x000055d8b87e1e16 in do_command (thd=0x7f01f8000b00) at /data/src/10.4/sql/sql_parse.cc:1365
#25 0x000055d8b8959e55 in do_handle_one_connection (connect=0x55d8bcbb29a0) at /data/src/10.4/sql/sql_connect.cc:1398
#26 0x000055d8b8959bc6 in handle_one_connection (arg=0x55d8bcbb29a0) at /data/src/10.4/sql/sql_connect.cc:1301
#27 0x000055d8b8e4dcb9 in pfs_spawn_thread (arg=0x55d8bcca54d0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#28 0x00007f0252dd8494 in start_thread (arg=0x7f0246258700) at pthread_create.c:333
#29 0x00007f0250fa693f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Not reproducible on 10.3.
No crashes on a non-debug build.


Generated at Thu Feb 08 08:49:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.