Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Cannot Reproduce
-
10.4(EOL), 10.5
-
None
Description
CREATE TABLE t1 (a TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP); |
INSERT INTO t1 VALUES ('2019-02-23 11:31:04'),('2023-02-09 00:00:00'); |
SELECT * FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END; |
|
# Cleanup
|
DROP TABLE t1; |
10.4 d87b725e |
mysqld: /data/src/10.4/sql/sql_type.cc:1015: Datetime_truncation_not_needed::Datetime_truncation_not_needed(THD*, Item*, date_conv_mode_t): Assertion `!is_valid_datetime() || fraction_remainder(((item->decimals) < (6) ? (item->decimals) : (6))) == 0' failed.
|
200203 1:50:27 [ERROR] mysqld got signal 6 ;
|
|
#7 0x00007f2aec0f6f12 in __GI___assert_fail (assertion=0x55c344052ea8 "!is_valid_datetime() || fraction_remainder(((item->decimals) < (6) ? (item->decimals) : (6))) == 0", file=0x55c344052be8 "/data/src/10.4/sql/sql_type.cc", line=1015, function=0x55c344054de0 <Datetime_truncation_not_needed::Datetime_truncation_not_needed(THD*, Item*, date_conv_mode_t)::__PRETTY_FUNCTION__> "Datetime_truncation_not_needed::Datetime_truncation_not_needed(THD*, Item*, date_conv_mode_t)") at assert.c:101
|
#8 0x000055c3434fd7b5 in Datetime_truncation_not_needed::Datetime_truncation_not_needed (this=0x7f2ae629ebe0, thd=0x7f2ad4000af0, item=0x7f2ad4017170, mode=...) at /data/src/10.4/sql/sql_type.cc:1013
|
#9 0x000055c3435b58cf in Datetime_truncation_not_needed::Datetime_truncation_not_needed (this=0x7f2ae629ebe0, thd=0x7f2ad4000af0, item=0x7f2ad4017170, mode=...) at /data/src/10.4/sql/sql_type.h:2336
|
#10 0x000055c343696e6a in Item_func_case::date_op (this=0x7f2ad4014280, thd=0x7f2ad4000af0, ltime=0x7f2ae629ec80, fuzzydate=...) at /data/src/10.4/sql/item_cmpfunc.cc:3097
|
#11 0x000055c3436e8992 in Item_func_hybrid_field_type::date_op_with_null_check (this=0x7f2ad4014280, thd=0x7f2ad4000af0, ltime=0x7f2ae629ec80) at /data/src/10.4/sql/item_func.h:675
|
#12 0x000055c3436d0ff5 in Item_func_hybrid_field_type::val_int_from_date_op (this=0x7f2ad4014280) at /data/src/10.4/sql/item_func.cc:882
|
#13 0x000055c34350707a in Type_handler_temporal_result::Item_func_hybrid_field_type_val_int (this=0x55c344aafc00 <type_handler_timestamp2>, item=0x7f2ad4014280) at /data/src/10.4/sql/sql_type.cc:4846
|
#14 0x000055c3432cad4f in Item_func_hybrid_field_type::val_int (this=0x7f2ad4014280) at /data/src/10.4/sql/item_func.h:757
|
#15 0x000055c343366c47 in evaluate_join_record (join=0x7f2ad4014c90, join_tab=0x7f2ad4016830, error=0) at /data/src/10.4/sql/sql_select.cc:20433
|
#16 0x000055c343366871 in sub_select (join=0x7f2ad4014c90, join_tab=0x7f2ad4016830, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20338
|
#17 0x000055c343365d00 in do_select (join=0x7f2ad4014c90, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19876
|
#18 0x000055c34333aca3 in JOIN::exec_inner (this=0x7f2ad4014c90) at /data/src/10.4/sql/sql_select.cc:4452
|
#19 0x000055c343339de0 in JOIN::exec (this=0x7f2ad4014c90) at /data/src/10.4/sql/sql_select.cc:4234
|
#20 0x000055c34333b4f5 in mysql_select (thd=0x7f2ad4000af0, tables=0x7f2ad4013828, wild_num=1, fields=..., conds=0x7f2ad4014280, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f2ad4014c68, unit=0x7f2ad4004a18, select_lex=0x7f2ad4013268) at /data/src/10.4/sql/sql_select.cc:4666
|
#21 0x000055c34332b0a6 in handle_select (thd=0x7f2ad4000af0, lex=0x7f2ad4004958, result=0x7f2ad4014c68, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:420
|
#22 0x000055c3432f17f7 in execute_sqlcom_select (thd=0x7f2ad4000af0, all_tables=0x7f2ad4013828) at /data/src/10.4/sql/sql_parse.cc:6360
|
#23 0x000055c3432e6ecd in mysql_execute_command (thd=0x7f2ad4000af0) at /data/src/10.4/sql/sql_parse.cc:3899
|
#24 0x000055c3432f5903 in mysql_parse (thd=0x7f2ad4000af0, rawbuf=0x7f2ad4013198 "SELECT * FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END", length=54, parser_state=0x7f2ae62a0160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
|
#25 0x000055c3432e0ad0 in dispatch_command (command=COM_QUERY, thd=0x7f2ad4000af0, packet=0x7f2ad40083a1 "", packet_length=54, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
|
#26 0x000055c3432df15d in do_command (thd=0x7f2ad4000af0) at /data/src/10.4/sql/sql_parse.cc:1360
|
#27 0x000055c343468377 in do_handle_one_connection (connect=0x55c346f5d340) at /data/src/10.4/sql/sql_connect.cc:1412
|
#28 0x000055c3434680c6 in handle_one_connection (arg=0x55c346f5d340) at /data/src/10.4/sql/sql_connect.cc:1316
|
#29 0x000055c343e708c9 in pfs_spawn_thread (arg=0x55c346e7c2a0) at /data/src/10.4/storage/perfschema/pfs.cc:1869
|
#30 0x00007f2aee07f4a4 in start_thread (arg=0x7f2ae62a1700) at pthread_create.c:456
|
#31 0x00007f2aec1b3d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
|
Reproducible on 10.4 and 10.5 with at least MyISAM and InnoDB.
Not reproducible on 10.3.
Non-debug version doesn't crash, but the result is questionable:
MariaDB [test]> SELECT * FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END; |
Empty set (0.000 sec) |
I would expect either a warning to be produced (something about a value in the WHERE clause being of a wrong type), or a result set to be returned. But it's difficult to say for sure what should be returned in this case, so maybe it's not a problem.
Attachments
Issue Links
- is blocked by
-
MDEV-21639 DEFAULT(col) evaluates to a bad value in WHERE clause
- Closed
- relates to
-
MDEV-22854 Garbage returned with SELECT CASE..DEFAULT(timestamp_field_with_now_as_default)
- Closed