[MDEV-17435] Server crashes inst_select_lex::get_free_table_map upon attempt to update view through 2nd execution of SP Created: 2018-10-12  Updated: 2022-11-10  Resolved: 2022-11-10

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Alice Sherepa Assignee: Oleksandr Byelkin
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-24823 Crash with invalid multi-table update... Closed
Relates
relates to MDEV-16940 Server crashes in unsafe_key_update u... Closed

 Description   

CREATE TABLE t1 (pk int);
CREATE TABLE t2 (c1 int, pk int);
 
create view v1 as select * from t1;
create view v2 as select * from t2;
 
create procedure p1 ()
UPDATE (v1 RIGHT JOIN (t1 JOIN v2 ON (t2.c1 = t1.c1)) ON (t2.c1 = t1.c1)) SET t1.pk = 94;
 
--error 1054
CALL p1();
CALL p1();

 5.5 0b7339eb451d5ffb141ac0a89b3596eec6dc948f
#3  <signal handler called>
#4  0x0000000000605100 in st_select_lex::get_free_table_map (this=0x7f11b79391e8, map=0x7f11be698ce8, tablenr=0x7f11be698ce4) at /5.5/sql/sql_lex.cc:3630
#5  0x00000000005e792b in mysql_derived_merge (thd=0x7f11b93e6060, lex=0x7f11b7938a58, derived=0x7f11b797a888) at /5.5/sql/sql_derived.cc:401
#6  0x00000000005e75ff in mysql_handle_single_derived (lex=0x7f11b7938a58, derived=0x7f11b797a888, phases=8) at /5.5/sql/sql_derived.cc:194
#7  0x00000000006f02b6 in TABLE_LIST::handle_derived (this=0x7f11b797a888, lex=0x7f11b7938a58, phases=8) at /5.5/sql/table.cc:6688
#8  0x0000000000605053 in st_select_lex::handle_derived (this=0x7f11b79391e8, lex=0x7f11b7938a58, phases=8) at /5.5/sql/sql_lex.cc:3600
#9  0x00000000006d2b23 in mysql_multi_update_prepare (thd=0x7f11b93e6060) at /5.5/sql/sql_update.cc:1256
#10 0x0000000000611212 in mysql_execute_command (thd=0x7f11b93e6060) at /5.5/sql/sql_parse.cc:2858
#11 0x000000000091b85e in sp_instr_stmt::exec_core (this=0x7f11b799a450, thd=0x7f11b93e6060, nextp=0x7f11be6998ac) at /5.5/sql/sp_head.cc:3220
#12 0x000000000091afc6 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f11b799a490, thd=0x7f11b93e6060, nextp=0x7f11be6998ac, open_tables=false, instr=0x7f11b799a450) at /5.5/sql/sp_head.cc:2998
#13 0x000000000091b56a in sp_instr_stmt::execute (this=0x7f11b799a450, thd=0x7f11b93e6060, nextp=0x7f11be6998ac) at /5.5/sql/sp_head.cc:3144
#14 0x0000000000916f07 in sp_head::execute (this=0x7f11b7938078, thd=0x7f11b93e6060, merge_da_on_success=true) at /5.5/sql/sp_head.cc:1431
#15 0x0000000000918e91 in sp_head::execute_procedure (this=0x7f11b7938078, thd=0x7f11b93e6060, args=0x7f11b93ea020) at /5.5/sql/sp_head.cc:2197
#16 0x00000000006151b6 in mysql_execute_command (thd=0x7f11b93e6060) at /5.5/sql/sql_parse.cc:4115
#17 0x0000000000619d76 in mysql_parse (thd=0x7f11b93e6060, rawbuf=0x7f11b78c4078 "CALL p1()", length=9, parser_state=0x7f11be69a670) at /5.5/sql/sql_parse.cc:5923
#18 0x000000000060cc84 in dispatch_command (command=COM_QUERY, thd=0x7f11b93e6060, packet=0x7f11b86f4061 "CALL p1()", packet_length=9) at /5.5/sql/sql_parse.cc:1066
#19 0x000000000060bdf5 in do_command (thd=0x7f11b93e6060) at /5.5/sql/sql_parse.cc:793
#20 0x0000000000721da4 in do_handle_one_connection (thd_arg=0x7f11b93e6060) at /5.5/sql/sql_connect.cc:1268
#21 0x0000000000721b0d in handle_one_connection (arg=0x7f11b93e6060) at /5.5/sql/sql_connect.cc:1184
#22 0x0000000000cc3b51 in pfs_spawn_thread (arg=0x7f11b869c080) at /5.5/storage/perfschema/pfs.cc:1015
#23 0x00007f11bda486ba in start_thread (arg=0x7f11be69b700) at pthread_create.c:333
#24 0x00007f11bceef41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109



 Comments   
Comment by Alice Sherepa [ 2022-11-10 ]

fixed by b3b5d57e78f835473d13d383caac commit (MDEV-24823 Crash with invalid multi-table update)

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