Description:
Run these queries:
CREATE TABLE t0 ( c29 INT , c53 DOUBLE ( 82 , 11 ) DEFAULT ( -1312010754708079168 ) ) ;
INSERT INTO t0 VALUES ( 14 , -1606648902726106250 IN ( 17 , -2142816117635615462 , -124 ) ) , ( 11 , 102 ) ;
CREATE INDEX i0 ON t0 ( c29 ) ;
INSERT INTO t0 VALUES ( DEFAULT , DEFAULT ) , ( DEFAULT , DEFAULT ) ;
SELECT t0 . c53 AS c43 FROM ( SELECT ( SELECT c29 AS c38 FROM ( SELECT c53 AS c16 FROM t0 ORDER BY c16 ) AS t1 ( c34 ) LIMIT 1 ) AS c22 FROM t0 ) AS t2 JOIN t0 ON t0 . c29 = t2 . c22 ;
Will trigger assertion failure.
GDB info:
#0 0x00007ffff6b1300b in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff6af2859 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff6af2729 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff6b03fd6 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x0000555559b1db1d in Field_double::val_real (this=0x612000340ff0) at /home/wx/mysql-8.0.34/sql/field.cc:4318
#5 0x0000555559c352fc in Item_field::val_real (this=0x613000d2f030) at /home/wx/mysql-8.0.34/sql/item.cc:3026
#6 0x0000555559b666cb in (anonymous namespace)::make_sortkey_from_item (item=item@entry=0x613000d2f030, result_type=<optimized out>, dst_length=..., tmp_buffer=<optimized out>, to=<optimized out>, to_end=<optimized out>, maybe_null=<optimized out>, hash=<optimized out>) at /home/wx/mysql-8.0.34/sql/filesort.cc:1364
#7 0x0000555559b687fa in Sort_param::make_sortkey (this=this@entry=0x613000d78db8, dst=..., tables=..., longest_addon_so_far=longest_addon_so_far@entry=0x7fffc6f61a50) at /home/wx/mysql-8.0.34/sql/filesort.cc:1420
#8 0x0000555559b7075a in Sort_param::make_sortkey (this=<optimized out>, dst=<optimized out>, dst_len=<optimized out>, tables=...) at /home/wx/mysql-8.0.34/sql/sort_param.h:408
#9 0x0000555559b6ab0f in Bounded_queue<unsigned char*, unsigned char*, Sort_param, (anonymous namespace)::Mem_compare_queue_key>::push<Mem_root_array<TABLE*> > (this=this@entry=0x7fffc6f62180, opaque=...) at /home/wx/mysql-8.0.34/sql/bounded_queue.h:129
#10 0x0000555559b6b1f3 in read_all_rows (thd=thd@entry=0x6270002bf900, param=param@entry=0x613000d78db8, tables=..., tables_to_get_rowid_for=tables_to_get_rowid_for@entry=1, fs_info=fs_info@entry=0x613000d792d8, chunk_file=chunk_file@entry=0x7fffc6f624c0, tempfile=<optimized out>, pq=<optimized out>, source_iterator=<optimized out>, found_rows=<optimized out>, longest_key=<optimized out>, longest_addons=<optimized out>) at /home/wx/mysql-8.0.34/sql/filesort.cc:1004
#11 0x0000555559b6c655 in filesort (thd=<optimized out>, filesort=0x613000d78d70, source_iterator=source_iterator@entry=0x60b000155ee0, tables_to_get_rowid_for=tables_to_get_rowid_for@entry=1, num_rows_estimate=num_rows_estimate@entry=4, fs_info=fs_info@entry=0x613000d792d8, sort_result=<optimized out>, found_rows=<optimized out>) at /home/wx/mysql-8.0.34/sql/filesort.cc:504
#12 0x0000555559ecd719 in SortingIterator::DoSort (this=this@entry=0x613000d792b0) at /home/wx/mysql-8.0.34/sql/iterators/sorting_iterator.cc:531
#13 0x0000555559ece024 in SortingIterator::Init (this=0x613000d792b0) at /home/wx/mysql-8.0.34/sql/iterators/sorting_iterator.cc:444
#14 0x000055555a293b23 in LimitOffsetIterator::Init (this=0x60c0001304b0) at /home/wx/mysql-8.0.34/sql/iterators/composite_iterators.cc:100
#15 0x00005555597138da in Query_expression::ExecuteIteratorQuery (this=this@entry=0x612000341d70, thd=thd@entry=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_union.cc:1763
#16 0x0000555559713ecd in Query_expression::execute (this=this@entry=0x612000341d70, thd=thd@entry=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_union.cc:1823
#17 0x0000555559e1f26d in SubqueryWithResult::exec (this=<optimized out>, thd=thd@entry=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/item_subselect.cc:3062
#18 0x0000555559e32301 in Item_subselect::exec (this=this@entry=0x612000342070, thd=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/item_subselect.cc:695
#19 0x0000555559e1c775 in Item_singlerow_subselect::val_int (this=0x612000342070) at /home/wx/mysql-8.0.34/sql/item_subselect.cc:1236
#20 0x0000555559c65f4d in Item::save_in_field_inner (this=0x612000342070, field=0x6120003430f0, no_conversions=<optimized out>) at /home/wx/mysql-8.0.34/sql/item.cc:6764
#21 0x00005555593ff0ba in Item::save_in_field_no_error_check (this=this@entry=0x612000342070, field=0x6120003430f0, no_conversions=no_conversions@entry=true) at /home/wx/mysql-8.0.34/sql/item.h:1321
#22 0x00005555593e753c in copy_funcs (param=<optimized out>, thd=<optimized out>, type=type@entry=CFT_ALL) at /home/wx/mysql-8.0.34/sql/sql_executor.cc:436
#23 0x000055555a29e05b in MaterializeIterator<DummyIteratorProfiler>::MaterializeQueryBlock (this=this@entry=0x6110000d7cf0, query_block=..., stored_rows=stored_rows@entry=0x7fffc6f63b10) at /home/wx/mysql-8.0.34/sql/iterators/composite_iterators.cc:1201
#24 0x000055555a2a5500 in MaterializeIterator<DummyIteratorProfiler>::Init (this=0x6110000d7cf0) at /home/wx/mysql-8.0.34/sql/iterators/composite_iterators.cc:930
#25 0x0000555559f04c9b in FilterIterator::Init (this=<optimized out>) at /home/wx/mysql-8.0.34/sql/iterators/composite_iterators.h:83
#26 0x000055555a295825 in NestedLoopIterator::Read (this=0x608000ef8dd0) at /home/wx/mysql-8.0.34/sql/iterators/composite_iterators.cc:487
#27 0x0000555559713b95 in Query_expression::ExecuteIteratorQuery (this=this@entry=0x612000341a70, thd=thd@entry=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_union.cc:1770
#28 0x0000555559713ecd in Query_expression::execute (this=this@entry=0x612000341a70, thd=thd@entry=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_union.cc:1823
#29 0x00005555595b1f79 in Sql_cmd_dml::execute_inner (this=0x60b0001556a0, thd=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_select.cc:1022
#30 0x00005555595ce209 in Sql_cmd_dml::execute (this=0x60b0001556a0, thd=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_select.cc:793
#31 0x00005555594bd568 in mysql_execute_command (thd=thd@entry=0x6270002bf900, first_level=first_level@entry=true) at /home/wx/mysql-8.0.34/sql/sql_parse.cc:4719
#32 0x00005555594c0bfe in dispatch_sql_command (thd=0x6270002bf900, parser_state=parser_state@entry=0x7fffc6f66c00) at /home/wx/mysql-8.0.34/sql/sql_parse.cc:5368
#33 0x00005555594c38e2 in dispatch_command (thd=thd@entry=0x6270002bf900, com_data=com_data@entry=0x7fffc6f68200, command=<optimized out>) at /home/wx/mysql-8.0.34/sql/sql_parse.cc:2054
#34 0x00005555594c7392 in do_command (thd=thd@entry=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_parse.cc:1439
#35 0x000055555989b7be in handle_connection (arg=arg@entry=0x607000322460) at /home/wx/mysql-8.0.34/sql/conn_handler/connection_handler_per_thread.cc:302
#36 0x000055555cc724e9 in pfs_spawn_thread (arg=0x614000140c60) at /home/wx/mysql-8.0.34/storage/perfschema/pfs.cc:3042
#37 0x00007ffff7568609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#38 0x00007ffff6bef133 in clone () from /lib/x86_64-linux-gnu/libc.so.6
How to repeat:
Run the queries above.