Details
-
Bug
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5
Description
USE test;
|
CREATE TABLE t (i INT, j INT, KEY(i)) ENGINE=InnoDB;
|
SELECT FIRST_VALUE(j) OVER (ORDER BY 0 + (SELECT FIRST_VALUE(upper.j) OVER (ORDER BY upper.j) FROM t LIMIT 1)) FROM t AS upper;
|
Leads to:
10.5.4 8569dac1ec9f6853a0b2f3ea9bcbda67644ead24 |
Core was generated by `/test/MD260520-mariadb-10.5.4-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
|
Program terminated with signal SIGSEGV, Segmentation fault.
|
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
|
at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
|
[Current thread is 1 (Thread 0x14c4294d1700 (LWP 3556701))]
|
(gdb) bt
|
(gdb) (gdb) #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
|
#1 0x000055dfe7fb8337 in my_write_core (sig=sig@entry=11) at /test/10.5_opt/mysys/stacktrace.c:518
|
#2 0x000055dfe797a3ca in handle_fatal_signal (sig=11) at /test/10.5_opt/sql/signal_handler.cc:330
|
#3 <signal handler called>
|
#4 set_field_to_null_with_conversions (field=0x0, no_conversions=true) at /test/10.5_opt/sql/field_conv.cc:205
|
#5 0x000055dfe79905e6 in Item::save_in_field (this=0x14c406847ee0, field=0x0, no_conversions=<optimized out>) at /test/10.5_opt/sql/item.cc:6605
|
#6 0x000055dfe77d5913 in Item_result_field::save_in_result_field (no_conversions=true, this=<optimized out>) at /test/10.5_opt/sql/item.h:3255
|
#7 copy_sum_funcs (end_ptr=0x14c40684be68, func_ptr=0x14c40684be60) at /test/10.5_opt/sql/sql_select.cc:25650
|
#8 end_write_group (join=0x14c40684a948, join_tab=0x14c4068c93d8, end_of_records=<optimized out>) at /test/10.5_opt/sql/sql_select.cc:22272
|
#9 0x000055dfe77da87b in AGGR_OP::end_send (this=0x14c4068cc3c8) at /test/10.5_opt/sql/sql_select.cc:28855
|
#10 0x000055dfe77daaee in sub_select_postjoin_aggr (join=0x14c40684a948, join_tab=0x14c4068c93d8, end_of_records=<optimized out>) at /test/10.5_opt/sql/sql_select.cc:20325
|
#11 0x000055dfe77e226d in do_select (procedure=<optimized out>, join=0x14c40684a948) at /test/10.5_opt/sql/sql_select.cc:20151
|
#12 JOIN::exec_inner (this=this@entry=0x14c40684a948) at /test/10.5_opt/sql/sql_select.cc:4464
|
#13 0x000055dfe77e2677 in JOIN::exec (this=this@entry=0x14c40684a948) at /test/10.5_opt/sql/sql_select.cc:4245
|
#14 0x000055dfe77e09c2 in mysql_select (thd=thd@entry=0x14c406812018, tables=0x14c4068498c0, fields=@0x14c4068472e0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c406849800, last = 0x14c406849800, elements = 1}, <No data fields>}, conds=0x0, og_num=<optimized out>, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14c40684a920, unit=0x14c406815e70, select_lex=0x14c406847190) at /test/10.5_opt/sql/sql_select.cc:4669
|
#15 0x000055dfe77e1381 in handle_select (thd=thd@entry=0x14c406812018, lex=lex@entry=0x14c406815da8, result=result@entry=0x14c40684a920, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_opt/sql/sql_select.cc:417
|
#16 0x000055dfe7787e91 in execute_sqlcom_select (thd=thd@entry=0x14c406812018, all_tables=0x14c4068498c0) at /test/10.5_opt/sql/sql_parse.cc:6207
|
#17 0x000055dfe7783db2 in mysql_execute_command (thd=thd@entry=0x14c406812018) at /test/10.5_opt/sql/sql_parse.cc:3939
|
#18 0x000055dfe778afac in mysql_parse (thd=0x14c406812018, rawbuf=<optimized out>, length=126, parser_state=0x14c4294d04b0, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /test/10.5_opt/sql/sql_parse.cc:7991
|
#19 0x000055dfe77802b5 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14c406812018, packet=packet@entry=0x14c40683a019 "", packet_length=packet_length@entry=126, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_opt/sql/sql_parse.cc:1874
|
#20 0x000055dfe777e6a4 in do_command (thd=0x14c406812018) at /test/10.5_opt/sql/sql_parse.cc:1355
|
#21 0x000055dfe7873891 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x14c428c329b8, put_in_cache=put_in_cache@entry=true) at /test/10.5_opt/sql/sql_connect.cc:1411
|
#22 0x000055dfe7873bf4 in handle_one_connection (arg=arg@entry=0x14c428c329b8) at /test/10.5_opt/sql/sql_connect.cc:1313
|
#23 0x000055dfe7be006a in pfs_spawn_thread (arg=0x14c428c4b018) at /test/10.5_opt/storage/perfschema/pfs.cc:2201
|
#24 0x000014c42a4c86db in start_thread (arg=0x14c4294d1700) at pthread_create.c:463
|
#25 0x000014c4298c688f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
Bug confirmed present in:
MariaDB: 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 10.3.24 (opt), 10.4.14 (dbg), 10.4.14 (opt), 10.5.4 (dbg), 10.5.4 (opt)
Bug confirmed not present in:
MariaDB: 10.1.46 (dbg), 10.1.46 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)
Issue is not reproducible on MyISAM, Aria or MEMORY. MyISAM example on 10.5.4 (opt):
10.5.4 8569dac1ec9f6853a0b2f3ea9bcbda67644ead24 |
10.5.4>SELECT FIRST_VALUE(j) OVER (ORDER BY 0 + (SELECT FIRST_VALUE(upper.j) OVER (ORDER BY upper.j) FROM t LIMIT 1)) FROM t AS upper;
|
+---------------------------------------------------------------------------------------------------------+
|
| FIRST_VALUE(j) OVER (ORDER BY 0 + (SELECT FIRST_VALUE(upper.j) OVER (ORDER BY upper.j) FROM t LIMIT 1)) |
|
+---------------------------------------------------------------------------------------------------------+
|
| NULL |
|
+---------------------------------------------------------------------------------------------------------+
|
1 row in set (0.006 sec)
|
Attachments
Issue Links
- relates to
-
MDEV-11867 Invalid use of group function -
-
- Closed
-
-
MDEV-15210 item_windowfunc.cc:445: virtual Field* Item_sum_hybrid_simple::create_tmp_field(bool, TABLE*): Assertion `0' failed.
-
- Closed
-
Confirming the crash that Marko saw. Running this testcase:
USE test;
CREATE TABLE t (i INT, j INT);
SELECT LAST_VALUE(j) OVER (ORDER BY 0 + (SELECT FIRST_VALUE(upper.j) OVER (ORDER BY upper.j) FROM t LIMIT 1)) FROM t AS upper;
Against debug build produces:
10.5.5 e1013725ce0f3f947e728491eef75d9985e8db2f
Core was generated by `/test/MD250620-mariadb-10.5.5-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x14cfe0580700 (LWP 1330641))]
(gdb) bt
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1 0x000055e3ab5987d0 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
#2 0x000055e3aad5147a in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
#3 <signal handler called>
#4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5 0x000014cfde8168b1 in __GI_abort () at abort.c:79
#6 0x000014cfde80642a in __assert_fail_base (fmt=0x14cfde98da38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=assertion@entry=0x55e3ab8d266f "0", file=file@entry=0x55e3ab8f4b20 "/test/10.5_dbg/sql/item_windowfunc.cc",
line=line@entry=462,
function=function@entry=0x55e3ab8f53e0 <Item_sum_hybrid_simple::create_tmp_field(st_mem_root*, bool, TABLE*)::__PRETTY_FUNCTION__> "virtual Field* Item_sum_hybrid_simple::create_tmp_field(MEM_ROOT*, bool, TABLE*)") at assert.c:92
#7 0x000014cfde8064a2 in __GI___assert_fail (assertion=assertion@entry=0x55e3ab8d266f "0",
file=file@entry=0x55e3ab8f4b20 "/test/10.5_dbg/sql/item_windowfunc.cc", line=line@entry=462,
function=function@entry=0x55e3ab8f53e0 <Item_sum_hybrid_simple::create_tmp_field(st_mem_root*, bool, TABLE*)::__PRETTY_FUNCTION__> "virtual Field* Item_sum_hybrid_simple::create_tmp_field(MEM_ROOT*, bool, TABLE*)") at assert.c:101
#8 0x000055e3aaf5ec4e in Item_sum_hybrid_simple::create_tmp_field (this=<optimized out>, root=<optimized out>,
group=<optimized out>, table=<optimized out>) at /test/10.5_dbg/sql/item_windowfunc.cc:462
#9 0x000055e3aace4c87 in Item_sum::create_tmp_field_ex (this=<optimized out>, root=<optimized out>, table=<optimized out>,
src=<optimized out>, param=<optimized out>) at /test/10.5_dbg/sql/item_sum.h:522
#10 0x000055e3aaaf25f9 in create_tmp_field (table=table@entry=0x14cfba17c0a0, item=item@entry=0x14cfba074f50,
copy_func=copy_func@entry=0x14cfe057dc68, from_field=from_field@entry=0x14cfba17d478, default_field=0x14cfba17d428,
group=<optimized out>, modify_item=true, table_cant_handle_bit_fields=false, make_copy_field=false)
at /test/10.5_dbg/sql/sql_select.cc:18045
#11 0x000055e3aaaf354e in Create_tmp_table::add_fields (this=this@entry=0x14cfe057dce0, thd=thd@entry=0x14cfba015088,
table=table@entry=0x14cfba17c0a0, param=param@entry=0x14cfba1782b0, fields=...) at /test/10.5_dbg/sql/sql_select.cc:18542
#12 0x000055e3aab18ba8 in create_tmp_table (thd=0x14cfba015088, param=0x14cfba1782b0, fields=..., group=group@entry=0x0,
distinct=distinct@entry=false, save_sum_fields=save_sum_fields@entry=true, select_options=2147748608,
rows_limit=18446744073709551615, table_alias=0x55e3ac0dbb80 <empty_clex_str>, do_not_open=true, keep_row_order=false)
at /test/10.5_dbg/sql/sql_select.cc:19156
#13 0x000055e3aab18f1a in JOIN::create_postjoin_aggr_table (this=this@entry=0x14cfba0779b8, tab=tab@entry=0x14cfba175448,
table_fields=table_fields@entry=0x14cfba077ce0, table_group=0x0, save_sum_fields=<optimized out>,
distinct=distinct@entry=false, keep_row_order=false) at /test/10.5_dbg/sql/sql_select.cc:3736
#14 0x000055e3aab19d1b in JOIN::make_aggr_tables_info (this=this@entry=0x14cfba0779b8) at /test/10.5_dbg/sql/sql_select.cc:3333
#15 0x000055e3aab1ec33 in JOIN::optimize_stage2 (this=this@entry=0x14cfba0779b8) at /test/10.5_dbg/sql/sql_select.cc:2977
#16 0x000055e3aab22d83 in JOIN::optimize_inner (this=this@entry=0x14cfba0779b8) at /test/10.5_dbg/sql/sql_select.cc:2262
#17 0x000055e3aab230a6 in JOIN::optimize (this=this@entry=0x14cfba0779b8) at /test/10.5_dbg/sql/sql_select.cc:1612
#18 0x000055e3aab23a33 in mysql_select (thd=thd@entry=0x14cfba015088, tables=<optimized out>, fields=..., conds=0x0, og_num=0,
order=<optimized out>, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14cfba077990,
unit=0x14cfba0190a0, select_lex=0x14cfba074200) at /test/10.5_dbg/sql/sql_select.cc:4635
#19 0x000055e3aab23daf in handle_select (thd=thd@entry=0x14cfba015088, lex=lex@entry=0x14cfba018fd8,
result=result@entry=0x14cfba077990, setup_tables_done_option=setup_tables_done_option@entry=0)
at /test/10.5_dbg/sql/sql_select.cc:417
#20 0x000055e3aaaad6c9 in execute_sqlcom_select (thd=thd@entry=0x14cfba015088, all_tables=0x14cfba076930)
at /test/10.5_dbg/sql/sql_parse.cc:6211
#21 0x000055e3aaaa67c2 in mysql_execute_command (thd=thd@entry=0x14cfba015088) at /test/10.5_dbg/sql/sql_parse.cc:3939
#22 0x000055e3aaab3638 in mysql_parse (thd=thd@entry=0x14cfba015088, rawbuf=<optimized out>, length=<optimized out>,
parser_state=parser_state@entry=0x14cfe057f350, is_com_multi=is_com_multi@entry=false,
is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7995
#23 0x000055e3aaaa0110 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14cfba015088,
packet=packet@entry=0x14cfba067089 "SELECT LAST_VALUE(j) OVER (ORDER BY 0 + (SELECT FIRST_VALUE(upper.j) OVER (ORDER BY upper.j) FROM t LIMIT 1)) FROM t AS upper", packet_length=packet_length@entry=125, is_com_multi=is_com_multi@entry=false,
is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1874
#24 0x000055e3aaa9e8ea in do_command (thd=0x14cfba015088) at /test/10.5_dbg/sql/sql_parse.cc:1355
#25 0x000055e3aabfa15f in do_handle_one_connection (connect=<optimized out>, connect@entry=0x14cfbf4d2028,
put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
#26 0x000055e3aabfa87b in handle_one_connection (arg=arg@entry=0x14cfbf4d2028) at /test/10.5_dbg/sql/sql_connect.cc:1313
#27 0x000055e3ab05d11c in pfs_spawn_thread (arg=0x14cfdd446508) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
#28 0x000014cfdf4f96db in start_thread (arg=0x14cfe0580700) at pthread_create.c:463
#29 0x000014cfde8f7a3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95