[MDEV-18145] Assertion `0' failed in Item::val_native upon SELECT subquery with timestamp Created: 2019-01-06  Updated: 2019-01-14  Resolved: 2019-01-14

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

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


 Description   

CREATE TABLE t1 (a INT) ENGINE=MyISAM;
 
CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1),(2);
 
CREATE TABLE t3 (pk INT PRIMARY KEY, b TIMESTAMP) ENGINE=MyISAM;
 
SELECT ( SELECT b FROM t1 LIMIT 1 ) AS sq FROM t2 LEFT JOIN t3 USING (pk);
 
# Cleanup
DROP TABLE t1, t2, t3;

10.4 2465d3e00

mysqld: /data/src/10.4/sql/item.h:1344: virtual bool Item::val_native(THD*, Native*): Assertion `0' failed.
190106  2:37:13 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f6fadfecee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x000055b4406f7f72 in Item::val_native (this=0x7f6f98079be8, thd=0x7f6f98000b00, to=0x7f6fa817ceb0) at /data/src/10.4/sql/item.h:1344
#9  0x000055b440beb4e0 in Item_singlerow_subselect::val_native (this=0x7f6f980168e0, thd=0x7f6f98000b00, to=0x7f6fa817ceb0) at /data/src/10.4/sql/item_subselect.cc:1359
#10 0x000055b440a061fc in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (this=0x7f6fa817ceb0, thd=0x7f6f98000b00, item=0x7f6f980168e0, conv=false) at /data/src/10.4/sql/sql_type.cc:8155
#11 0x000055b440a09f3d in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null (this=0x7f6fa817ceb0, thd=0x7f6f98000b00, item=0x7f6f980168e0) at /data/src/10.4/sql/sql_type.h:2457
#12 0x000055b440a00ca7 in Type_handler::Item_send_timestamp (this=0x55b441e1c2b0 <type_handler_timestamp2>, item=0x7f6f980168e0, protocol=0x7f6f980010c0, buf=0x7f6fa817cfc0) at /data/src/10.4/sql/sql_type.cc:6704
#13 0x000055b440a0d19c in Type_handler_timestamp_common::Item_send (this=0x55b441e1c2b0 <type_handler_timestamp2>, item=0x7f6f980168e0, protocol=0x7f6f980010c0, buf=0x7f6fa817cfc0) at /data/src/10.4/sql/sql_type.h:5465
#14 0x000055b4406f7d4e in Item::send (this=0x7f6f980168e0, protocol=0x7f6f980010c0, buffer=0x7f6fa817cfc0) at /data/src/10.4/sql/item.h:1032
#15 0x000055b4406f27cc in Protocol::send_result_set_row (this=0x7f6f980010c0, row_items=0x7f6f980151c0) at /data/src/10.4/sql/protocol.cc:986
#16 0x000055b44079cf56 in select_send::send_data (this=0x7f6f98018810, items=...) at /data/src/10.4/sql/sql_class.cc:2948
#17 0x000055b44087e152 in end_send (join=0x7f6f98018838, join_tab=0x7f6f9801a7a8, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20570
#18 0x000055b44087b989 in evaluate_join_record (join=0x7f6f98018838, join_tab=0x7f6f9801a3f8, error=0) at /data/src/10.4/sql/sql_select.cc:19610
#19 0x000055b44087b269 in sub_select (join=0x7f6f98018838, join_tab=0x7f6f9801a3f8, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:19390
#20 0x000055b44087a7a3 in do_select (join=0x7f6f98018838, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:18930
#21 0x000055b440853203 in JOIN::exec_inner (this=0x7f6f98018838) at /data/src/10.4/sql/sql_select.cc:4094
#22 0x000055b440852644 in JOIN::exec (this=0x7f6f98018838) at /data/src/10.4/sql/sql_select.cc:3888
#23 0x000055b440853903 in mysql_select (thd=0x7f6f98000b00, tables=0x7f6f98016b00, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f6f98018810, unit=0x7f6f980049c0, select_lex=0x7f6f98015090) at /data/src/10.4/sql/sql_select.cc:4293
#24 0x000055b44084520f in handle_select (thd=0x7f6f98000b00, lex=0x7f6f980048f8, result=0x7f6f98018810, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:385
#25 0x000055b44080f439 in execute_sqlcom_select (thd=0x7f6f98000b00, all_tables=0x7f6f98016b00) at /data/src/10.4/sql/sql_parse.cc:6567
#26 0x000055b440805a34 in mysql_execute_command (thd=0x7f6f98000b00) at /data/src/10.4/sql/sql_parse.cc:3776
#27 0x000055b440813244 in mysql_parse (thd=0x7f6f98000b00, rawbuf=0x7f6f98014f98 "SELECT ( SELECT b FROM t1 LIMIT 1 ) AS sq FROM t2 LEFT JOIN t3 USING (pk)", length=73, parser_state=0x7f6fa817e600, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8104
#28 0x000055b44080046e in dispatch_command (command=COM_QUERY, thd=0x7f6f98000b00, packet=0x7f6f9800b421 "", packet_length=73, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1851
#29 0x000055b4407fee92 in do_command (thd=0x7f6f98000b00) at /data/src/10.4/sql/sql_parse.cc:1396
#30 0x000055b44096b0ba in do_handle_one_connection (connect=0x55b4436216b0) at /data/src/10.4/sql/sql_connect.cc:1402
#31 0x000055b44096ae3e in handle_one_connection (arg=0x55b4436216b0) at /data/src/10.4/sql/sql_connect.cc:1308
#32 0x000055b440e2a164 in pfs_spawn_thread (arg=0x55b443565970) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#33 0x00007f6fafaa8494 in start_thread (arg=0x7f6fa817f700) at pthread_create.c:333
#34 0x00007f6fae0a993f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Reproducible with at least MyISAM and Aria.
Not reproducible on 10.3.
No visible effect on a non-debug build.


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