Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
N/A
Description
CREATE TABLE t (c TIMESTAMP); |
PREPARE s FROM 'DELETE FROM t WHERE c=?'; |
EXECUTE s USING 1; |
INSERT INTO t (c) VALUES (now()); |
EXECUTE s USING NULL; |
Leads to:
CS 10.6.21 7372ecc396517839a1546a8c1dd9192711922ef1 (Debug) |
mariadbd: /test/10.6_dbg/sql/item.cc:4657: virtual bool Item_param::get_date(THD*, MYSQL_TIME*, date_mode_t): Assertion `type_handler()->result_type() == value.type_handler()->result_type()' failed.
|
CS 10.6.21 7372ecc396517839a1546a8c1dd9192711922ef1 (Debug) |
Core was generated by `/test/MD061224-mariadb-10.6.21-linux-x86_64-dbg/bin/mariadbd --no-defaults --ma'.
|
Program terminated with signal SIGABRT, Aborted.
|
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
[Current thread is 1 (Thread 0x147bb8102700 (LWP 3470158))]
|
(gdb) bt
|
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
#1 0x0000147bcf727859 in __GI_abort () at abort.c:79
|
#2 0x0000147bcf727729 in __assert_fail_base (fmt=0x147bcf8bd588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x559dbce30d38 "type_handler()->result_type() == value.type_handler()->result_type()", file=0x559dbce2fbb5 "/test/10.6_dbg/sql/item.cc", line=4657, function=<optimized out>) at assert.c:92
|
#3 0x0000147bcf738fd6 in __GI___assert_fail (assertion=assertion@entry=0x559dbce30d38 "type_handler()->result_type() == value.type_handler()->result_type()", file=file@entry=0x559dbce2fbb5 "/test/10.6_dbg/sql/item.cc", line=line@entry=4657, function=function@entry=0x559dbce30d80 "virtual bool Item_param::get_date(THD*, MYSQL_TIME*, date_mode_t)") at assert.c:101
|
#4 0x0000559dbc3523df in Item_param::get_date (this=0x147b8c029990, thd=0x147b8c000d48, res=0x147bb80ffac0, fuzzydate={m_mode = (date_mode_t::FUZZY_DATES | date_mode_t::FRAC_TRUNCATE | date_mode_t::INVALID_DATES)}) at /test/10.6_dbg/sql/sql_type.h:7572
|
#5 0x0000559dbbf85351 in Item::get_date_result (this=this@entry=0x147b8c029990, thd=thd@entry=0x147b8c000d48, ltime=ltime@entry=0x147bb80ffac0, fuzzydate=<optimized out>) at /test/10.6_dbg/sql/item.h:2109
|
#6 0x0000559dbc358d48 in Item::val_datetime_packed_result (this=this@entry=0x147b8c029990, thd=0x147b8c000d48) at /test/10.6_dbg/sql/sql_basic_types.h:81
|
#7 0x0000559dbc358e53 in Item_cache_temporal::cache_value (this=0x147b8c0134a0) at /test/10.6_dbg/sql/item.cc:10453
|
#8 0x0000559dbc36f20c in Item_cache::has_value (this=0x147b8c0134a0) at /test/10.6_dbg/sql/item.h:7584
|
#9 Item_cache_datetime::val_datetime_packed (this=0x147b8c0134a0) at /test/10.6_dbg/sql/item.h:7584
|
#10 0x0000559dbc383880 in Arg_comparator::compare_datetime (this=0x147b8c029bf0) at /test/10.6_dbg/sql/item_cmpfunc.cc:796
|
#11 0x0000559dbc382340 in Arg_comparator::compare (this=0x147b8c029bf0) at /test/10.6_dbg/sql/item_cmpfunc.h:117
|
#12 Item_func_eq::val_bool (this=0x147b8c029b40) at /test/10.6_dbg/sql/item_cmpfunc.cc:1851
|
#13 0x0000559dbc51a4dc in SQL_SELECT::skip_record (thd=0x147b8c000d48, this=0x147b8c013540) at /test/10.6_dbg/sql/opt_range.h:1740
|
#14 record_should_be_deleted (thd=thd@entry=0x147b8c000d48, table=table@entry=0x147b8c025d58, sel=sel@entry=0x147b8c013540, explain=explain@entry=0x147b8c013710, truncate_history=truncate_history@entry=false) at /test/10.6_dbg/sql/sql_delete.cc:229
|
#15 0x0000559dbc51d5c7 in mysql_delete (thd=thd@entry=0x147b8c000d48, table_list=0x147b8c029168, conds=<optimized out>, order_list=order_list@entry=0x147b8c027ff8, limit=18446744073709551615, options=<optimized out>, result=<optimized out>) at /test/10.6_dbg/sql/sql_delete.cc:833
|
#16 0x0000559dbc072140 in mysql_execute_command (thd=0x147b8c000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=true) at /test/10.6_dbg/sql/sql_limit.h:94
|
#17 0x0000559dbc086972 in Prepared_statement::execute (this=this@entry=0x147b8c01bd98, expanded_query=expanded_query@entry=0x147bb8100cd0, open_cursor=open_cursor@entry=false) at /test/10.6_dbg/sql/sql_prepare.cc:5265
|
#18 0x0000559dbc086d0b in Prepared_statement::execute_loop (this=this@entry=0x147b8c01bd98, expanded_query=expanded_query@entry=0x147bb8100cd0, open_cursor=open_cursor@entry=false, packet=packet@entry=0x0, packet_end=packet_end@entry=0x0) at /test/10.6_dbg/sql/sql_prepare.cc:4671
|
#19 0x0000559dbc08737e in mysql_sql_stmt_execute (thd=thd@entry=0x147b8c000d48) at /test/10.6_dbg/sql/sql_prepare.cc:3697
|
#20 0x0000559dbc06fcff in mysql_execute_command (thd=thd@entry=0x147b8c000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.6_dbg/sql/sql_parse.cc:4020
|
#21 0x0000559dbc05cdde in mysql_parse (thd=thd@entry=0x147b8c000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x147bb8101320) at /test/10.6_dbg/sql/sql_parse.cc:8199
|
#22 0x0000559dbc06b28b in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x147b8c000d48, packet=packet@entry=0x147b8c00ade9 "EXECUTE s USING NULL", packet_length=packet_length@entry=20, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1419
|
#23 0x0000559dbc06d997 in do_command (thd=thd@entry=0x147b8c000d48, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1422
|
#24 0x0000559dbc1beb95 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x559dbfa75178, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1386
|
#25 0x0000559dbc1bf063 in handle_one_connection (arg=0x559dbfa75178) at /test/10.6_dbg/sql/sql_connect.cc:1298
|
#26 0x0000147bcfc53609 in start_thread (arg=<optimized out>) at pthread_create.c:477
|
#27 0x0000147bcf824133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
Bug confirmed present in:
MariaDB: 10.6.21 (dbg)
The issue occurs after this commit
commit 3de412fbe884a85b2ec7ae56fee47152c008e6c0 (HEAD)
|
Author: Alexander Barkov <bar@mariadb.com>
|
Date: Tue Nov 19 12:44:42 2024 +0400
|
|
MDEV-25593 Assertion `0' failed in Type_handler_temporal_result::Item_get_date on double EXECUTE
|
|
When binding to NULL, DEFAULT or IGNORE from an Item value, Item_param did not
|
change m_type_handler, so its value remained from the previous bind.
|
Thid led to DBUG_ASSERTs in Item_param::get_date() and
|
Timestamp_or_zero_datetime_native_null.
|
|
Fix:
|
|
Set Item_param::m_type_handler to &type_handler_null when
|
binding from an Item returning NULL.
|
|
This patch also fixes MDEV-35427.
|
Attachments
Issue Links
- is caused by
-
MDEV-25593 Assertion `0' failed in Type_handler_temporal_result::Item_get_date on double EXECUTE
- Closed
Another test case with slightly different stack
Leads to
CS 10.6.21 7372ecc396517839a1546a8c1dd9192711922ef1 (Debug)
mariadbd: /test/10.6_dbg/sql/item.cc:4657: virtual bool Item_param::get_date(THD*, MYSQL_TIME*, date_mode_t): Assertion `type_handler()->result_type() == value.type_handler()->result_type()' failed.
CS 10.6.21 7372ecc396517839a1546a8c1dd9192711922ef1 (Debug)
Core was generated by `/test/MD061224-mariadb-10.6.21-linux-x86_64-dbg/bin/mariadbd --no-defaults --ma'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x15079c053700 (LWP 254192))]
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x000015079edbc859 in __GI_abort () at abort.c:79
#2 0x000015079edbc729 in __assert_fail_base (fmt=0x15079ef52588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x555eb5645d38 "type_handler()->result_type() == value.type_handler()->result_type()", file=0x555eb5644bb5 "/test/10.6_dbg/sql/item.cc", line=4657, function=<optimized out>) at assert.c:92
#3 0x000015079edcdfd6 in __GI___assert_fail (assertion=assertion@entry=0x555eb5645d38 "type_handler()->result_type() == value.type_handler()->result_type()", file=file@entry=0x555eb5644bb5 "/test/10.6_dbg/sql/item.cc", line=line@entry=4657, function=function@entry=0x555eb5645d80 "virtual bool Item_param::get_date(THD*, MYSQL_TIME*, date_mode_t)") at assert.c:101
#4 0x0000555eb4b673df in Item_param::get_date (this=0x15075801e958, thd=0x150758000d48, res=0x15079c050930, fuzzydate={m_mode = (date_mode_t::FRAC_TRUNCATE | date_mode_t::NO_ZERO_IN_DATE)}) at /test/10.6_dbg/sql/sql_type.h:7572
#5 0x0000555eb4a77941 in Temporal_with_date::make_from_item (this=this@entry=0x15079c050930, thd=0x150758000d48, item=0x15075801e958, fuzzydate=<optimized out>) at /test/10.6_dbg/sql/sql_type.cc:1003
#6 0x0000555eb4a853dd in Temporal_with_date::Temporal_with_date (fuzzydate=<optimized out>, item=<optimized out>, thd=<optimized out>, this=0x15079c050930) at /test/10.6_dbg/sql/sql_type.h:2160
#7 Datetime::Datetime (this=0x15079c050930, thd=<optimized out>, item=<optimized out>, fuzzydate=<optimized out>) at /test/10.6_dbg/sql/sql_type.h:2443
#8 0x0000555eb4a7eb3d in Type_handler_timestamp_common::Item_val_native_with_conversion (this=this@entry=0x555eb5dd0350 <type_handler_timestamp2>, thd=thd@entry=0x150758000d48, item=item@entry=0x15075801e958, to=to@entry=0x15079c0509e0) at /test/10.6_dbg/sql/sql_basic_types.h:81
#9 0x0000555eb4a7ef8b in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (this=0x15079c0509e0, thd=0x150758000d48, item=0x15075801e958, conv=<optimized out>) at /test/10.6_dbg/sql/sql_type.cc:9265
#10 0x0000555eb4c8201c in Item_func_unix_timestamp::get_timestamp_value (this=0x15075801eb38, seconds=seconds@entry=0x15079c050a58, second_part=second_part@entry=0x15079c050a50) at /test/10.6_dbg/sql/item_timefunc.cc:1226
#11 0x0000555eb4c8219e in Item_func_unix_timestamp::int_op (this=<optimized out>) at /test/10.6_dbg/sql/item_timefunc.cc:1243
#12 0x0000555eb4beb72e in Item_func_hybrid_field_type::val_str_from_int_op (this=0x15075801eb38, str=0x15079c050ae0) at /test/10.6_dbg/sql/item_func.cc:831
#13 0x0000555eb4a6303f in Type_handler_int_result::Item_func_hybrid_field_type_val_str (this=<optimized out>, item=<optimized out>, str=<optimized out>) at /test/10.6_dbg/sql/sql_type.cc:5489
#14 0x0000555eb4bb07d3 in Item_func_hybrid_field_type::val_str (this=0x15075801eb38, str=0x15079c050ae0) at /test/10.6_dbg/sql/sql_type.h:7572
#15 0x0000555eb4b6ef61 in Item_func_conv_charset::Item_func_conv_charset (cache_if_const=true, cs=0x555eb5d6d7c0 <my_charset_ucs2_general_ci>, a=0x15075801eb38, thd=0x150758000d48, this=0x150758013a58) at /test/10.6_dbg/sql/sql_string.h:301
#16 Item::safe_charset_converter (this=0x15075801eb38, thd=0x150758000d48, tocs=0x555eb5d6d7c0 <my_charset_ucs2_general_ci>) at /test/10.6_dbg/sql/item.cc:1314
#17 0x0000555eb4b8320a in Type_std_attributes::agg_item_set_converter (this=this@entry=0x15075801ec50, coll=@0x15075801ec58: {collation = 0x555eb5d6d7c0 <my_charset_ucs2_general_ci>, derivation = DERIVATION_COERCIBLE, repertoire = MY_REPERTOIRE_ASCII}, fname=@0x15079c050c10: {str = 0x555eb56565cf "concat", length = 6}, args=args@entry=0x15075801ecc0, nargs=nargs@entry=1, flags=flags@entry=11, item_sep=1, single_err=0x0) at /test/10.6_dbg/sql/item.cc:2704
#18 0x0000555eb4c2f5c1 in Type_std_attributes::agg_arg_charsets (item_sep=1, flags=11, nitems=1, items=0x15075801ecc0, func_name=@0x15079c050c10: {str = 0x555eb56565cf "concat", length = 6}, c=@0x15075801ec58: {collation = 0x555eb5d6d7c0 <my_charset_ucs2_general_ci>, derivation = DERIVATION_COERCIBLE, repertoire = MY_REPERTOIRE_ASCII}, this=0x15075801ec50) at /test/10.6_dbg/sql/sql_type.h:3337
#19 Type_std_attributes::agg_arg_charsets_for_string_result (item_sep=1, nitems=1, items=0x15075801ecc0, func_name=@0x15079c050c10: {str = 0x555eb56565cf "concat", length = 6}, c=@0x15075801ec58: {collation = 0x555eb5d6d7c0 <my_charset_ucs2_general_ci>, derivation = DERIVATION_COERCIBLE, repertoire = MY_REPERTOIRE_ASCII}, this=0x15075801ec50) at /test/10.6_dbg/sql/sql_type.h:3352
#20 Item_func_or_sum::agg_arg_charsets_for_string_result (item_sep=1, nitems=1, items=0x15075801ecc0, c=@0x15075801ec58: {collation = 0x555eb5d6d7c0 <my_charset_ucs2_general_ci>, derivation = DERIVATION_COERCIBLE, repertoire = MY_REPERTOIRE_ASCII}, this=0x15075801ec48) at /test/10.6_dbg/sql/item.h:5587
#21 Item_func_concat::fix_length_and_dec (this=0x15075801ec48) at /test/10.6_dbg/sql/item_strfunc.cc:711
#22 0x0000555eb4bdb8a6 in Item_func::fix_fields (this=this@entry=0x15075801ec48, thd=thd@entry=0x150758000d48, ref=<optimized out>) at /test/10.6_dbg/sql/item_func.cc:378
#23 0x0000555eb4c293e6 in Item_str_func::fix_fields (this=0x15075801ec48, thd=0x150758000d48, ref=<optimized out>) at /test/10.6_dbg/sql/item_strfunc.cc:129
#24 0x0000555eb48087f9 in Item::fix_fields_if_needed (ref=0x15075801ed18, thd=0x150758000d48, this=0x15075801ec48) at /test/10.6_dbg/sql/item.h:1182
#25 Item::fix_fields_if_needed_for_scalar (ref=0x15075801ed18, thd=0x150758000d48, this=0x15075801ec48) at /test/10.6_dbg/sql/item.h:1182
#26 setup_fields (thd=0x150758000d48, ref_pointer_array=<optimized out>, fields=<optimized out>, column_usage=column_usage@entry=MARK_COLUMNS_READ, sum_func_list=sum_func_list@entry=0x150758013688, pre_fix=0x15075801e718, allow_sum_func=true, where=THD_WHERE::DEFAULT_WHERE) at /test/10.6_dbg/sql/sql_base.cc:7777
#27 0x0000555eb48e3fdc in JOIN::prepare (this=this@entry=0x150758013328, tables_init=tables_init@entry=0x0, conds_init=conds_init@entry=0x0, og_num=og_num@entry=0, order_init=order_init@entry=0x0, skip_order_by=skip_order_by@entry=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x15075801e440, unit_arg=0x15075801c7e0) at /test/10.6_dbg/sql/sql_select.cc:1512
#28 0x0000555eb48fbffa in mysql_select (thd=thd@entry=0x150758000d48, tables=0x0, fields=@0x15075801e700: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x15075801ed10, last = 0x15075801ed10, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2201171004160, result=0x15075801f5b8, unit=0x15075801c7e0, select_lex=0x15075801e440) at /test/10.6_dbg/sql/sql_select.cc:5169
#29 0x0000555eb48fc1e9 in handle_select (thd=thd@entry=0x150758000d48, lex=lex@entry=0x15075801c718, result=result@entry=0x15075801f5b8, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.6_dbg/sql/sql_select.cc:573
#30 0x0000555eb48786b2 in execute_sqlcom_select (thd=thd@entry=0x150758000d48, all_tables=0x0) at /test/10.6_dbg/sql/sql_parse.cc:6412
#31 0x0000555eb4884c9f in mysql_execute_command (thd=0x150758000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:4004
#32 0x0000555eb489b972 in Prepared_statement::execute (this=this@entry=0x15075801a258, expanded_query=expanded_query@entry=0x15079c051cd0, open_cursor=open_cursor@entry=false) at /test/10.6_dbg/sql/sql_prepare.cc:5265
#33 0x0000555eb489bd0b in Prepared_statement::execute_loop (this=this@entry=0x15075801a258, expanded_query=expanded_query@entry=0x15079c051cd0, open_cursor=open_cursor@entry=false, packet=packet@entry=0x0, packet_end=packet_end@entry=0x0) at /test/10.6_dbg/sql/sql_prepare.cc:4671
#34 0x0000555eb489c37e in mysql_sql_stmt_execute (thd=thd@entry=0x150758000d48) at /test/10.6_dbg/sql/sql_prepare.cc:3697
#35 0x0000555eb4884cff in mysql_execute_command (thd=thd@entry=0x150758000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.6_dbg/sql/sql_parse.cc:4020
#36 0x0000555eb4871dde in mysql_parse (thd=thd@entry=0x150758000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x15079c052320) at /test/10.6_dbg/sql/sql_parse.cc:8199
#37 0x0000555eb488028b in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x150758000d48, packet=packet@entry=0x15075800ade9 "EXECUTE s USING DEFAULT", packet_length=packet_length@entry=23, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1419
#38 0x0000555eb4882997 in do_command (thd=thd@entry=0x150758000d48, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1422
#39 0x0000555eb49d3b95 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x555eb6f0e178, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1386
#40 0x0000555eb49d4063 in handle_one_connection (arg=0x555eb6f0e178) at /test/10.6_dbg/sql/sql_connect.cc:1298
#41 0x000015079f2e8609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#42 0x000015079eeb9133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95