Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 10.11, 11.0(EOL)
Description
We have other open bugs for multi-update (and of course for views and 2nd execution), but I haven't found the exact match, so I'm filing it separately.
CREATE TABLE t1 (a INT); |
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a FROM t1; |
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM ( SELECT v1.a FROM t1, v1 ) AS sq; |
CREATE PROCEDURE p() UPDATE v2 SET a = 2; |
|
--error ER_NON_UPDATABLE_TABLE
|
CALL p;
|
CREATE OR REPLACE TABLE t1 (b INT); |
CALL p;
|
|
# Cleanup
|
DROP PROCEDURE p; |
DROP VIEW v2; |
DROP VIEW v1; |
DROP TABLE t1; |
10.4 d87b725e |
#3 <signal handler called>
|
#4 0x0000559533b1a574 in mysql_derived_prepare (thd=0x7f4090000af0, lex=0x7f409013ec68, derived=0x7f4090047a08) at /data/src/10.4/sql/sql_derived.cc:908
|
#5 0x0000559533b19227 in mysql_derived_merge_for_insert (thd=0x7f4090000af0, lex=0x7f409013ec68, derived=0x7f4090047a08) at /data/src/10.4/sql/sql_derived.cc:541
|
#6 0x0000559533b18326 in mysql_handle_derived (lex=0x7f409013ec68, phases=16) at /data/src/10.4/sql/sql_derived.cc:126
|
#7 0x0000559533c863c5 in Multiupdate_prelocking_strategy::handle_end (this=0x7f40a005aa10, thd=0x7f4090000af0) at /data/src/10.4/sql/sql_update.cc:1680
|
#8 0x0000559533c86bb5 in mysql_multi_update_prepare (thd=0x7f4090000af0) at /data/src/10.4/sql/sql_update.cc:1846
|
#9 0x0000559533b74b6a in mysql_execute_command (thd=0x7f4090000af0) at /data/src/10.4/sql/sql_parse.cc:4408
|
#10 0x0000559533a8412e in sp_instr_stmt::exec_core (this=0x7f40901860d8, thd=0x7f4090000af0, nextp=0x7f40a005b6a4) at /data/src/10.4/sql/sp_head.cc:3683
|
#11 0x0000559533a83503 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f4090186120, thd=0x7f4090000af0, nextp=0x7f40a005b6a4, open_tables=false, instr=0x7f40901860d8) at /data/src/10.4/sql/sp_head.cc:3415
|
#12 0x0000559533a83cf2 in sp_instr_stmt::execute (this=0x7f40901860d8, thd=0x7f4090000af0, nextp=0x7f40a005b6a4) at /data/src/10.4/sql/sp_head.cc:3589
|
#13 0x0000559533a7d3eb in sp_head::execute (this=0x7f4090184ba8, thd=0x7f4090000af0, merge_da_on_success=true) at /data/src/10.4/sql/sp_head.cc:1361
|
#14 0x0000559533a8021f in sp_head::execute_procedure (this=0x7f4090184ba8, thd=0x7f4090000af0, args=0x7f40900058e0) at /data/src/10.4/sql/sp_head.cc:2366
|
#15 0x0000559533b7018d in do_execute_sp (thd=0x7f4090000af0, sp=0x7f4090184ba8) at /data/src/10.4/sql/sql_parse.cc:3015
|
#16 0x0000559533b70e74 in Sql_cmd_call::execute (this=0x7f4090013240, thd=0x7f4090000af0) at /data/src/10.4/sql/sql_parse.cc:3257
|
#17 0x0000559533b7c241 in mysql_execute_command (thd=0x7f4090000af0) at /data/src/10.4/sql/sql_parse.cc:6102
|
#18 0x0000559533b81903 in mysql_parse (thd=0x7f4090000af0, rawbuf=0x7f4090013198 "CALL p", length=6, parser_state=0x7f40a005d160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
|
#19 0x0000559533b6cad0 in dispatch_command (command=COM_QUERY, thd=0x7f4090000af0, packet=0x7f40900083a1 "CALL p", packet_length=6, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
|
#20 0x0000559533b6b15d in do_command (thd=0x7f4090000af0) at /data/src/10.4/sql/sql_parse.cc:1360
|
#21 0x0000559533cf4377 in do_handle_one_connection (connect=0x559537e0c7d0) at /data/src/10.4/sql/sql_connect.cc:1412
|
#22 0x0000559533cf40c6 in handle_one_connection (arg=0x559537e0c7d0) at /data/src/10.4/sql/sql_connect.cc:1316
|
#23 0x00005595346fc8c9 in pfs_spawn_thread (arg=0x559537d2fa90) at /data/src/10.4/storage/perfschema/pfs.cc:1869
|
#24 0x00007f40a7e3c4a4 in start_thread (arg=0x7f40a005e700) at pthread_create.c:456
|
#25 0x00007f40a5f70d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
|
Fails the same way on debug and non-debug builds.
Reproducible with at least MyISAM, InnoDB, Aria.
Reproducible on 10.2-10.5, the test case is not applicable to 10.1.
Attachments
Issue Links
- relates to
-
MDEV-19817 Server crashes in Multiupdate_prelocking_strategy::handle_end upon UPDATE with view and foreign key
-
- Open
-
-
MDEV-20410 Pure virtual method called in Item_ref::set_properties, SIGSEGV or ASAN heap-use-after-free in create_view_field
-
- Closed
-
-
MDEV-33001 ASAN heap-use-after-free in mysql_insert_select_prepare stack
-
- Open
-
-
MDEV-24823 Crash with invalid multi-table update of view in 2nd execution of SP
-
- Closed
-
Additional testcase. Note the t, in the UPDATE is necessary, or we will get ERROR 1288 (HY000): The target table d of the UPDATE is not updatable, giving a hint as to where the issue may be.
CALL p();
CALL p();
Leads to:
11.0.1 f2dc4d4c10ac36a73b5c1eb765352d3aee808d66 (Debug)
Core was generated by `/test/MD180223-mariadb-11.0.1-linux-x86_64-dbg/bin/mariadbd --no-defaults --cor'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00005638afc69d62 in mysql_derived_prepare (thd=thd@entry=0x14ab60000d58,
lex=lex@entry=0x14ab60046020, derived=derived@entry=0x14ab6004a890)
at /test/11.0_dbg/sql/sql_derived.cc:949
949 delete derived->derived_result;
[Current thread is 1 (Thread 0x14ac1808d640 (LWP 1874037))]
(gdb) bt
#0 0x00005638afc69d62 in mysql_derived_prepare (thd=thd@entry=0x14ab60000d58, lex=lex@entry=0x14ab60046020, derived=derived@entry=0x14ab6004a890) at /test/11.0_dbg/sql/sql_derived.cc:949
#1 0x00005638afc69e80 in mysql_derived_merge_for_insert (thd=0x14ab60000d58, lex=0x14ab60046020, derived=0x14ab6004a890) at /test/11.0_dbg/sql/sql_derived.cc:532
#2 0x00005638afc679a9 in mysql_handle_derived (lex=lex@entry=0x14ab60046020, phases=phases@entry=16) at /test/11.0_dbg/sql/sql_derived.cc:123
#3 0x00005638afdb630a in Multiupdate_prelocking_strategy::handle_end (this=0x14ac1808a910, thd=0x14ab60000d58) at /test/11.0_dbg/sql/sql_update.cc:1733
#4 0x00005638afc3a79d in open_tables (thd=thd@entry=0x14ab60000d58, options=@0x14ab60047660: {m_options = DDL_options_st::OPT_NONE}, start=start@entry=0x14ac1808a908, counter=counter@entry=0x14ac1808a904, flags=0, prelocking_strategy=prelocking_strategy@entry=0x14ac1808a910) at /test/11.0_dbg/sql/sql_base.cc:4709
#5 0x00005638afdb85ab in open_tables (prelocking_strategy=0x14ac1808a910, flags=<optimized out>, counter=0x14ac1808a904, tables=0x14ac1808a908, thd=0x14ab60000d58) at /test/11.0_dbg/sql/sql_base.h:266
#6 mysql_multi_update_prepare (thd=thd@entry=0x14ab60000d58) at /test/11.0_dbg/sql/sql_update.cc:1890
#7 0x00005638afcb5a68 in mysql_execute_command (thd=0x14ab60000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.0_dbg/sql/sql_parse.cc:4455
#8 0x00005638afbf23c2 in sp_instr_stmt::exec_core (this=0x14ab60049bc0, thd=<optimized out>, nextp=0x14ac1808b374) at /test/11.0_dbg/sql/sp_head.cc:3857
#9 0x00005638afbff5d4 in sp_lex_keeper::reset_lex_and_exec_core (this=this@entry=0x14ab60049c08, thd=thd@entry=0x14ab60000d58, nextp=nextp@entry=0x14ac1808b374, open_tables=open_tables@entry=false, instr=instr@entry=0x14ab60049bc0) at /test/11.0_dbg/sql/sp_head.cc:3582
#10 0x00005638afbffd43 in sp_instr_stmt::execute (this=0x14ab60049bc0, thd=0x14ab60000d58, nextp=0x14ac1808b374) at /test/11.0_dbg/sql/sp_head.cc:3763
#11 0x00005638afbf8338 in sp_head::execute (this=this@entry=0x14ab60044000, thd=thd@entry=0x14ab60000d58, merge_da_on_success=merge_da_on_success@entry=true) at /test/11.0_dbg/sql/sp_head.cc:1459
#12 0x00005638afbfa5da in sp_head::execute_procedure (this=0x14ab60044000, thd=thd@entry=0x14ab60000d58, args=0x14ab60005ed8) at /test/11.0_dbg/sql/sp_head.cc:2446
#13 0x00005638afca8473 in do_execute_sp (thd=thd@entry=0x14ab60000d58, sp=sp@entry=0x14ab60044000) at /test/11.0_dbg/sql/sql_parse.cc:3026
#14 0x00005638afcacc00 in Sql_cmd_call::execute (this=0x14ab600131e8, thd=0x14ab60000d58) at /test/11.0_dbg/sql/sql_parse.cc:3271
#15 0x00005638afcb9db6 in mysql_execute_command (thd=thd@entry=0x14ab60000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.0_dbg/sql/sql_parse.cc:6003
#16 0x00005638afcbb7cf in mysql_parse (thd=thd@entry=0x14ab60000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14ac1808c2c0) at /test/11.0_dbg/sql/sql_parse.cc:8002
#17 0x00005638afcbd963 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14ab60000d58, packet=packet@entry=0x14ab6000ae19 "CALL p()", packet_length=packet_length@entry=8, blocking=blocking@entry=true) at /test/11.0_dbg/sql/sql_class.h:242
#18 0x00005638afcbf7bc in do_command (thd=0x14ab60000d58, blocking=blocking@entry=true) at /test/11.0_dbg/sql/sql_parse.cc:1407
#19 0x00005638afe106e2 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5638b26ec358, put_in_cache=put_in_cache@entry=true) at /test/11.0_dbg/sql/sql_connect.cc:1416
#20 0x00005638afe10941 in handle_one_connection (arg=0x5638b26ec358) at /test/11.0_dbg/sql/sql_connect.cc:1318
#21 0x000014ac371d0b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#22 0x000014ac37262a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
Bug confirmed present in:
MariaDB: 10.3.38 (dbg), 10.4.29 (dbg), 10.4.29 (opt), 10.5.20 (dbg), 10.5.20 (opt), 10.6.13 (dbg), 10.7.8 (dbg), 10.8.8 (dbg), 10.9.6 (dbg), 10.10.4 (dbg), 10.11.2 (dbg), 11.0.1 (dbg)
Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.3.38 (opt), 10.6.13 (opt), 10.7.8 (opt), 10.8.8 (opt), 10.9.6 (opt), 10.10.4 (opt), 10.11.2 (opt), 11.0.1 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.40 (dbg), 5.7.40 (opt), 8.0.31 (dbg), 8.0.31 (opt)