Details
- 
    
Bug
 - 
    Status: Confirmed (View Workflow)
 - 
    
Major
 - 
    Resolution: Unresolved
 - 
    10.6, 10.11, 11.8, 10.5(EOL), 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 11.0(EOL)
 - 
    None
 
Description
					CREATE TABLE t (  | 
		
					a INT UNSIGNED NOT NULL DEFAULT 0,  | 
		
					b INT AS (a) VIRTUAL,  | 
		
					c TIME,  | 
		
					d INT,  | 
		
					e DATE,  | 
		
					f VARCHAR(1024),  | 
		
					PRIMARY KEY(c),  | 
		
					KEY(c,b,d,f(64))  | 
		
					);
			 | 
		
					INSERT INTO t (c) VALUES ('00:00:00'),('00:00:04');  | 
		
					SELECT c FROM t WHERE c BETWEEN '00:00:00' AND '00:00:00' ORDER BY d;  | 
		
| 
					 | 
		
					# Cleanup
			 | 
		
					DROP TABLE t;  | 
		
| 
				 10.5 b03ab127  | 
		
					mariadbd: /data/src/10.5/sql/field.cc:4426: virtual longlong Field_long::val_int(): Assertion `marked_for_read()' failed.
			 | 
		
					220518 18:52:40 [ERROR] mysqld got signal 6 ;
			 | 
		
| 
					 | 
		
					#7  0x00007fe282233662 in __GI___assert_fail (assertion=0x55bf4143e61d "marked_for_read()", file=0x55bf4143e053 "/data/src/10.5/sql/field.cc", line=4426, function=0x55bf4143f5d0 "virtual longlong Field_long::val_int()") at assert.c:101
			 | 
		
					#8  0x000055bf4082b9e5 in Field_long::val_int (this=0x7fe26c2236f0) at /data/src/10.5/sql/field.cc:4426
			 | 
		
					#9  0x000055bf4067f765 in Field_num::save_in_field (this=0x7fe26c2236f0, to=0x7fe26c2237c8) at /data/src/10.5/sql/field.h:2065
			 | 
		
					#10 0x000055bf4067e57e in Field::store_field (this=0x7fe26c2237c8, from=0x7fe26c2236f0) at /data/src/10.5/sql/field.h:918
			 | 
		
					#11 0x000055bf4084f44f in field_conv_incompatible (to=0x7fe26c2237c8, from=0x7fe26c2236f0) at /data/src/10.5/sql/field_conv.cc:850
			 | 
		
					#12 0x000055bf4084f4ab in field_conv (to=0x7fe26c2237c8, from=0x7fe26c2236f0) at /data/src/10.5/sql/field_conv.cc:863
			 | 
		
					#13 0x000055bf40893265 in save_field_in_field (from=0x7fe26c2236f0, null_value=0x7fe26c1020be, to=0x7fe26c2237c8, no_conversions=false) at /data/src/10.5/sql/item.cc:6625
			 | 
		
					#14 0x000055bf408934a6 in Item_field::save_in_field (this=0x7fe26c102040, to=0x7fe26c2237c8, no_conversions=false) at /data/src/10.5/sql/item.cc:6676
			 | 
		
					#15 0x000055bf4064cafa in TABLE::update_virtual_fields (this=0x7fe26c202688, h=0x7fe26c100ce0, update_mode=VCOL_UPDATE_FOR_READ) at /data/src/10.5/sql/table.cc:8762
			 | 
		
					#16 0x000055bf40866906 in handler::ha_rnd_pos (this=0x7fe26c100ce0, buf=0x7fe26c101540 "\376", pos=0x7fe26c190cd8 "") at /data/src/10.5/sql/handler.cc:3137
			 | 
		
					#17 0x000055bf40a23422 in rr_from_pointers (info=0x7fe26c018fb0) at /data/src/10.5/sql/records.cc:615
			 | 
		
					#18 0x000055bf4043e59f in READ_RECORD::read_record (this=0x7fe26c018fb0) at /data/src/10.5/sql/records.h:80
			 | 
		
					#19 0x000055bf4057ca33 in join_init_read_record (tab=0x7fe26c018ee8) at /data/src/10.5/sql/sql_select.cc:21884
			 | 
		
					#20 0x000055bf4057a4c7 in sub_select (join=0x7fe26c017048, join_tab=0x7fe26c018ee8, end_of_records=false) at /data/src/10.5/sql/sql_select.cc:20917
			 | 
		
					#21 0x000055bf4057996d in do_select (join=0x7fe26c017048, procedure=0x0) at /data/src/10.5/sql/sql_select.cc:20452
			 | 
		
					#22 0x000055bf4054cfaf in JOIN::exec_inner (this=0x7fe26c017048) at /data/src/10.5/sql/sql_select.cc:4540
			 | 
		
					#23 0x000055bf4054c0b1 in JOIN::exec (this=0x7fe26c017048) at /data/src/10.5/sql/sql_select.cc:4320
			 | 
		
					#24 0x000055bf4054d907 in mysql_select (thd=0x7fe26c000db8, tables=0x7fe26c015a10, fields=..., conds=0x7fe26c0163c8, og_num=1, order=0x7fe26c016eb0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fe26c017020, unit=0x7fe26c004f60, select_lex=0x7fe26c0153f8) at /data/src/10.5/sql/sql_select.cc:4797
			 | 
		
					#25 0x000055bf4053d2d1 in handle_select (thd=0x7fe26c000db8, lex=0x7fe26c004e98, result=0x7fe26c017020, setup_tables_done_option=0) at /data/src/10.5/sql/sql_select.cc:444
			 | 
		
					#26 0x000055bf4050012a in execute_sqlcom_select (thd=0x7fe26c000db8, all_tables=0x7fe26c015a10) at /data/src/10.5/sql/sql_parse.cc:6330
			 | 
		
					#27 0x000055bf404f7461 in mysql_execute_command (thd=0x7fe26c000db8) at /data/src/10.5/sql/sql_parse.cc:4021
			 | 
		
					#28 0x000055bf40504f0b in mysql_parse (thd=0x7fe26c000db8, rawbuf=0x7fe26c015310 "SELECT c FROM t WHERE c BETWEEN '00:00:00' AND '00:00:00' ORDER BY d", length=68, parser_state=0x7fe27cbf0510, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:8116
			 | 
		
					#29 0x000055bf404f1034 in dispatch_command (command=COM_QUERY, thd=0x7fe26c000db8, packet=0x7fe26c00b5c9 "", packet_length=68, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1907
			 | 
		
					#30 0x000055bf404ef7c0 in do_command (thd=0x7fe26c000db8) at /data/src/10.5/sql/sql_parse.cc:1375
			 | 
		
					#31 0x000055bf4069ccd3 in do_handle_one_connection (connect=0x55bf43c8d6b8, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1418
			 | 
		
					#32 0x000055bf4069c995 in handle_one_connection (arg=0x55bf43c6d1c8) at /data/src/10.5/sql/sql_connect.cc:1312
			 | 
		
					#33 0x000055bf40bace9a in pfs_spawn_thread (arg=0x55bf43c8d438) at /data/src/10.5/storage/perfschema/pfs.cc:2201
			 | 
		
					#34 0x00007fe2826ffea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
			 | 
		
					#35 0x00007fe2822fcdef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
			 | 
		
Reproducible at least with InnoDB and MyISAM.
No obvious problem on a non-debug build.
Not reproducible on 10.4, but it could be because the plan there is different.
| 
				 10.5 (fails)  | 
		
					EXPLAIN EXTENDED
			 | 
		
					SELECT c FROM t WHERE c BETWEEN '00:00:00' AND '00:00:00' ORDER BY d;  | 
		
					id select_type table type possible_keys key key_len ref rows filtered Extra  | 
		
					1 SIMPLE t range PRIMARY,c c 3 NULL 1 100.00 Using where; Using index; Using filesort  | 
		
					Warnings:
			 | 
		
					Note 1003 select `test`.`t`.`c` AS `c` from `test`.`t` where `test`.`t`.`c` between '00:00:00.000000' and '00:00:00.000000' order by `test`.`t`.`d`  | 
		
| 
				 10.4 (does not fail)  | 
		
					EXPLAIN EXTENDED
			 | 
		
					SELECT c FROM t WHERE c BETWEEN '00:00:00' AND '00:00:00' ORDER BY d;  | 
		
					id select_type table type possible_keys key key_len ref rows filtered Extra  | 
		
					1 SIMPLE t index PRIMARY,c c 80 NULL 2 50.00 Using where; Using index; Using filesort  | 
		
					Warnings:
			 | 
		
					Note 1003 select `test`.`t`.`c` AS `c` from `test`.`t` where `test`.`t`.`c` between '00:00:00.000000' and '00:00:00.000000' order by `test`.`t`.`d`  |