Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Cannot Reproduce
-
10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 10.11
Description
CREATE TABLE t1 (a DATETIME DEFAULT CURRENT_TIMESTAMP, b INT); |
INSERT INTO t1 () VALUES (),(); |
SELECT * FROM t1 WHERE IFNULL(b, DEFAULT(a)) IS NOT NULL; |
|
# Cleanup
|
DROP TABLE t1; |
On a debug build with ASAN (on some reason only with ASAN) the test case causes an assertion failure:
10.4 071feae3 debug ASAN |
mysqld: /data/src/10.4/sql/compat56.cc:271: void TIME_from_longlong_datetime_packed(MYSQL_TIME*, longlong): Assertion `tmp != ((long long) 0x8000000000000000LL)' failed.
|
191230 2:14:18 [ERROR] mysqld got signal 6 ;
|
|
#6 0x00007fc1221c3e67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x556a7c450540 "tmp != ((long long) 0x8", '0' <repeats 15 times>, "LL)", file=file@entry=0x556a7c4502a0 "/data/src/10.4/sql/compat56.cc", line=line@entry=271, function=function@entry=0x556a7c4508e0 <TIME_from_longlong_datetime_packed(st_mysql_time*, long long)::__PRETTY_FUNCTION__> "void TIME_from_longlong_datetime_packed(MYSQL_TIME*, longlong)") at assert.c:92
|
#7 0x00007fc1221c3f12 in __GI___assert_fail (assertion=0x556a7c450540 "tmp != ((long long) 0x8", '0' <repeats 15 times>, "LL)", file=0x556a7c4502a0 "/data/src/10.4/sql/compat56.cc", line=271, function=0x556a7c4508e0 <TIME_from_longlong_datetime_packed(st_mysql_time*, long long)::__PRETTY_FUNCTION__> "void TIME_from_longlong_datetime_packed(MYSQL_TIME*, longlong)") at assert.c:101
|
#8 0x0000556a7acda9b4 in TIME_from_longlong_datetime_packed (ltime=0x7fc119518900, tmp=-9223372036854775808) at /data/src/10.4/sql/compat56.cc:271
|
#9 0x0000556a7ad17374 in Field_datetimef::get_TIME (this=0x62b0000648d8, ltime=0x7fc119518900, pos=0x62b0000649b9 "", fuzzydate=...) at /data/src/10.4/sql/field.cc:6971
|
#10 0x0000556a7ad46985 in Field_datetimef::get_date (this=0x62b0000648d8, ltime=0x7fc119518900, fuzzydate=...) at /data/src/10.4/sql/field.h:3467
|
#11 0x0000556a7adc999d in Item_field::get_date_result (this=0x62b0000632f8, thd=0x62b000046270, ltime=0x7fc119518900, fuzzydate=...) at /data/src/10.4/sql/item.cc:3229
|
#12 0x0000556a7adaf83f in Item::val_datetime_packed_result (this=0x62b0000632f8, thd=0x62b000046270) at /data/src/10.4/sql/item.cc:121
|
#13 0x0000556a7adfe484 in Item_cache_temporal::cache_value (this=0x62b0000666f0) at /data/src/10.4/sql/item.cc:9820
|
#14 0x0000556a7aaf1080 in Item_cache::has_value (this=0x62b0000666f0) at /data/src/10.4/sql/item.h:6573
|
#15 0x0000556a7ae0da9b in Item_cache_datetime::val_str (this=0x62b0000666f0, to=0x62b000063488) at /data/src/10.4/sql/item.h:6746
|
#16 0x0000556a7ae31f87 in Item_func_ifnull::str_op (this=0x62b000063458, str=0x62b000063488) at /data/src/10.4/sql/item_cmpfunc.cc:2389
|
#17 0x0000556a7aaebdb1 in Item_func_hybrid_field_type::str_op_with_null_check (this=0x62b000063458, str=0x62b000063488) at /data/src/10.4/sql/item_func.h:688
|
#18 0x0000556a7aaebee9 in Item_func_hybrid_field_type::val_str_from_str_op (this=0x62b000063458, str=0x7fc119518bb0) at /data/src/10.4/sql/item_func.h:697
|
#19 0x0000556a7aac90c7 in Type_handler_string_result::Item_func_hybrid_field_type_val_str (this=0x556a7d334ec0 <type_handler_varchar>, item=0x62b000063458, str=0x7fc119518bb0) at /data/src/10.4/sql/sql_type.cc:4930
|
#20 0x0000556a7a5d5380 in Item_func_hybrid_field_type::val_str (this=0x62b000063458, str=0x7fc119518bb0) at /data/src/10.4/sql/item_func.h:769
|
#21 0x0000556a7aac3f3a in Type_handler_string_result::Item_update_null_value (this=0x556a7d334ec0 <type_handler_varchar>, item=0x62b000063458) at /data/src/10.4/sql/sql_type.cc:3590
|
#22 0x0000556a7a39b574 in Item::update_null_value (this=0x62b000063458) at /data/src/10.4/sql/item.h:1783
|
#23 0x0000556a7a52bd74 in Item_func::is_null (this=0x62b000063458) at /data/src/10.4/sql/item_func.h:184
|
#24 0x0000556a7ae4b388 in Item_func_isnotnull::val_int (this=0x62b000063530) at /data/src/10.4/sql/item_cmpfunc.cc:5435
|
#25 0x0000556a7a72ddf1 in evaluate_join_record (join=0x62b000063f50, join_tab=0x62b000065d90, error=0) at /data/src/10.4/sql/sql_select.cc:20350
|
#26 0x0000556a7a72d254 in sub_select (join=0x62b000063f50, join_tab=0x62b000065d90, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20255
|
#27 0x0000556a7a72b63d in do_select (join=0x62b000063f50, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19793
|
#28 0x0000556a7a6c4a44 in JOIN::exec_inner (this=0x62b000063f50) at /data/src/10.4/sql/sql_select.cc:4452
|
#29 0x0000556a7a6c2350 in JOIN::exec (this=0x62b000063f50) at /data/src/10.4/sql/sql_select.cc:4234
|
#30 0x0000556a7a6c5e02 in mysql_select (thd=0x62b000046270, tables=0x62b000062970, wild_num=1, fields=..., conds=0x62b000063530, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b000063f20, unit=0x62b00004a198, select_lex=0x62b000062378) at /data/src/10.4/sql/sql_select.cc:4666
|
#31 0x0000556a7a69b649 in handle_select (thd=0x62b000046270, lex=0x62b00004a0d8, result=0x62b000063f20, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:420
|
#32 0x0000556a7a61dc83 in execute_sqlcom_select (thd=0x62b000046270, all_tables=0x62b000062970) at /data/src/10.4/sql/sql_parse.cc:6360
|
#33 0x0000556a7a60ba27 in mysql_execute_command (thd=0x62b000046270) at /data/src/10.4/sql/sql_parse.cc:3899
|
#34 0x0000556a7a6262a2 in mysql_parse (thd=0x62b000046270, rawbuf=0x62b000062290 "SELECT * FROM t1 WHERE IFNULL(b, DEFAULT(a)) IS NOT NULL", length=56, parser_state=0x7fc11951b290, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
|
#35 0x0000556a7a5ff555 in dispatch_command (command=COM_QUERY, thd=0x62b000046270, packet=0x629000221271 "", packet_length=56, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
|
#36 0x0000556a7a5fc455 in do_command (thd=0x62b000046270) at /data/src/10.4/sql/sql_parse.cc:1360
|
#37 0x0000556a7a9830b1 in do_handle_one_connection (connect=0x611000002630) at /data/src/10.4/sql/sql_connect.cc:1412
|
#38 0x0000556a7a982a65 in handle_one_connection (arg=0x611000002630) at /data/src/10.4/sql/sql_connect.cc:1316
|
#39 0x0000556a7bde6dfe in pfs_spawn_thread (arg=0x6160000033f0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
|
#40 0x00007fc12414c4a4 in start_thread (arg=0x7fc11951d300) at pthread_create.c:456
|
#41 0x00007fc122280d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
|
Reproducible on 10.3-10.5.
Non-ASAN builds of 10.3-10.5 and any builds of 10.1-10.2, as well as MySQL 5.6/5.7/8.0, don't crash, but they return the empty result set:
SELECT * FROM t1 WHERE IFNULL(b, DEFAULT(a)) IS NOT NULL; |
a b
|
DROP TABLE t1; |
This seems to be wrong, because IFNULL(b, DEFAULT(a)) IS NOT NULL is clearly true:
SELECT IFNULL(b, DEFAULT(a)) IS NOT NULL FROM t1; |
IFNULL(b, DEFAULT(a)) IS NOT NULL |
1
|
1
|
Also, if DATETIME is replaced with TIMESTAMP in the same case, then the result set is returned:
CREATE TABLE t1 (a TIMESTAMP DEFAULT CURRENT_TIMESTAMP, b INT); |
INSERT INTO t1 () VALUES (),(); |
SELECT * FROM t1 WHERE IFNULL(b, DEFAULT(a)) IS NOT NULL; |
a b
|
2019-12-30 02:23:13 NULL |
2019-12-30 02:23:13 NULL |
DROP TABLE t1; |
Finally, here is a variation of the test case which causes the same assertion failure on 10.3 and 10.5 ASAN builds, but a different one on 10.4 ASAN build. The change in the test case is the absence of IS NOT NULL in the WHERE clause:
CREATE TABLE t1 (a DATETIME DEFAULT CURRENT_TIMESTAMP, b INT); |
INSERT INTO t1 () VALUES (),(); |
SELECT * FROM t1 WHERE IFNULL(b, DEFAULT(a)); |
|
# Cleanup
|
DROP TABLE t1; |
10.4 071feae3 debug ASAN |
mysqld: /data/src/10.4/sql/sql_type.h:2064: Datetime::Datetime(THD*, Item*, date_mode_t): Assertion `is_valid_value_slow()' failed.
|
191230 2:26:42 [ERROR] mysqld got signal 6 ;
|
|
#7 0x00007fbb7fd4ff12 in __GI___assert_fail (assertion=0x556fa264dea0 "is_valid_value_slow()", file=0x556fa264de00 "/data/src/10.4/sql/sql_type.h", line=2064, function=0x556fa264ecc0 <Datetime::Datetime(THD*, Item*, date_mode_t)::__PRETTY_FUNCTION__> "Datetime::Datetime(THD*, Item*, date_mode_t)") at assert.c:101
|
#8 0x0000556fa08f961f in Datetime::Datetime (this=0x7fbb770a1df0, thd=0x62b000046270, item=0x62b000066590, fuzzydate=...) at /data/src/10.4/sql/sql_type.h:2064
|
#9 0x0000556fa1041438 in Datetime::Datetime (this=0x7fbb770a1e60, thd=0x62b000046270, item=0x62b000066590) at /data/src/10.4/sql/sql_type.h:2067
|
#10 0x0000556fa10414f5 in Datetime::Datetime (this=0x7fbb770a1e60, item=0x62b000066590) at /data/src/10.4/sql/sql_type.h:2070
|
#11 0x0000556fa136daf2 in Item_cache_datetime::val_str (this=0x62b000066590, to=0x62b000063470) at /data/src/10.4/sql/item.h:6746
|
#12 0x0000556fa1391f87 in Item_func_ifnull::str_op (this=0x62b000063440, str=0x62b000063470) at /data/src/10.4/sql/item_cmpfunc.cc:2389
|
#13 0x0000556fa104bdb1 in Item_func_hybrid_field_type::str_op_with_null_check (this=0x62b000063440, str=0x62b000063470) at /data/src/10.4/sql/item_func.h:688
|
#14 0x0000556fa1407059 in Item_func_hybrid_field_type::val_int_from_str_op (this=0x62b000063440) at /data/src/10.4/sql/item_func.cc:943
|
#15 0x0000556fa1029112 in Type_handler_string_result::Item_func_hybrid_field_type_val_int (this=0x556fa3894ec0 <type_handler_varchar>, item=0x62b000063440) at /data/src/10.4/sql/sql_type.cc:4948
|
#16 0x0000556fa0b350cf in Item_func_hybrid_field_type::val_int (this=0x62b000063440) at /data/src/10.4/sql/item_func.h:757
|
#17 0x0000556fa0c8ddf1 in evaluate_join_record (join=0x62b000063e60, join_tab=0x62b000065c30, error=0) at /data/src/10.4/sql/sql_select.cc:20350
|
#18 0x0000556fa0c8d254 in sub_select (join=0x62b000063e60, join_tab=0x62b000065c30, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20255
|
#19 0x0000556fa0c8b63d in do_select (join=0x62b000063e60, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19793
|
#20 0x0000556fa0c24a44 in JOIN::exec_inner (this=0x62b000063e60) at /data/src/10.4/sql/sql_select.cc:4452
|
#21 0x0000556fa0c22350 in JOIN::exec (this=0x62b000063e60) at /data/src/10.4/sql/sql_select.cc:4234
|
#22 0x0000556fa0c25e02 in mysql_select (thd=0x62b000046270, tables=0x62b000062958, wild_num=1, fields=..., conds=0x62b000063440, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b000063e30, unit=0x62b00004a198, select_lex=0x62b000062360) at /data/src/10.4/sql/sql_select.cc:4666
|
#23 0x0000556fa0bfb649 in handle_select (thd=0x62b000046270, lex=0x62b00004a0d8, result=0x62b000063e30, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:420
|
#24 0x0000556fa0b7dc83 in execute_sqlcom_select (thd=0x62b000046270, all_tables=0x62b000062958) at /data/src/10.4/sql/sql_parse.cc:6360
|
#25 0x0000556fa0b6ba27 in mysql_execute_command (thd=0x62b000046270) at /data/src/10.4/sql/sql_parse.cc:3899
|
#26 0x0000556fa0b862a2 in mysql_parse (thd=0x62b000046270, rawbuf=0x62b000062290 "SELECT * FROM t1 WHERE IFNULL(b, DEFAULT(a))", length=44, parser_state=0x7fbb770a4290, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
|
#27 0x0000556fa0b5f555 in dispatch_command (command=COM_QUERY, thd=0x62b000046270, packet=0x629000221271 "", packet_length=44, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
|
#28 0x0000556fa0b5c455 in do_command (thd=0x62b000046270) at /data/src/10.4/sql/sql_parse.cc:1360
|
#29 0x0000556fa0ee30b1 in do_handle_one_connection (connect=0x611000002630) at /data/src/10.4/sql/sql_connect.cc:1412
|
#30 0x0000556fa0ee2a65 in handle_one_connection (arg=0x611000002630) at /data/src/10.4/sql/sql_connect.cc:1316
|
#31 0x0000556fa2346dfe in pfs_spawn_thread (arg=0x6160000033f0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
|
#32 0x00007fbb81cd84a4 in start_thread (arg=0x7fbb770a6300) at pthread_create.c:456
|
#33 0x00007fbb7fe0cd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
|
Attachments
Issue Links
- relates to
-
MDEV-24510 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in TIME_from_longlong_datetime_packed & UBSAN: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'
- Closed
-
MDEV-26507 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in TIME_from_longlong_datetime_packed
- Closed
- split to
-
MDEV-35252 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in TIME_from_longlong_datetime_packed on EXPLAIN
- Confirmed