[MDEV-29174] Assertion failure with UPDATE of view using MERGE table Created: 2022-07-26  Updated: 2022-08-02  Resolved: 2022-08-02

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Update, Views
Affects Version/s: N/A
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Roel Van de Paar Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-28883 Re-design the upper level of handling... Closed

 Description   

Not present in 10.3-10.10 trunk. Present in current version of (as well as in the original/previous version of) bb-10.10-MDEV-28883.

CREATE TABLE t (a INT) ENGINE=InnoDB;
CREATE VIEW v AS SELECT a FROM t;
DROP TABLE t;
CREATE TABLE t (a INT) ENGINE=MERGE;
UPDATE v SET a=0;

Leads to:

bb-10.10-MDEV-28883 cd8b27bb537d03ed4042cdca3176ad7134b892a7 (Debug)

mysqld: /test/bb-10.10-MDEV-28883_dbg/sql/sql_base.cc:4746: bool open_tables(THD*, const DDL_options_st&, TABLE_LIST**, uint*, uint, Prelocking_strategy*): Assertion `tbl->pos_in_table_list == tables' failed.

bb-10.10-MDEV-28883 cd8b27bb537d03ed4042cdca3176ad7134b892a7 (Debug)

Core was generated by `/test/MDEV-28883_MD220722-mariadb-10.10.0-linux-x86_64-dbg/bin/mysqld --no-defa'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x14f74008a700 (LWP 547311))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014f75921c859 in __GI_abort () at abort.c:79
#2  0x000014f75921c729 in __assert_fail_base (fmt=0x14f7593b2588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55815529d820 "tbl->pos_in_table_list == tables", file=0x55815529bd18 "/test/bb-10.10-MDEV-28883_dbg/sql/sql_base.cc", line=4746, function=<optimized out>) at assert.c:92
#3  0x000014f75922dfd6 in __GI___assert_fail (assertion=assertion@entry=0x55815529d820 "tbl->pos_in_table_list == tables", file=file@entry=0x55815529bd18 "/test/bb-10.10-MDEV-28883_dbg/sql/sql_base.cc", line=line@entry=4746, function=function@entry=0x55815529d7c0 "bool open_tables(THD*, const DDL_options_st&, TABLE_LIST**, uint*, uint, Prelocking_strategy*)") at assert.c:101
#4  0x000055815464a730 in open_tables (thd=thd@entry=0x14f6dc000db8, options=@0x14f6dc0064f0: {m_options = DDL_options_st::OPT_NONE}, start=start@entry=0x14f740088e28, counter=counter@entry=0x14f6dc0145e8, flags=0, prelocking_strategy=prelocking_strategy@entry=0x14f6dc014608) at /test/bb-10.10-MDEV-28883_dbg/sql/sql_base.cc:4746
#5  0x000055815464b32d in open_tables (prelocking_strategy=0x14f6dc014608, flags=<optimized out>, counter=0x14f6dc0145e8, tables=0x14f740088e28, thd=0x14f6dc000db8) at /test/bb-10.10-MDEV-28883_dbg/sql/sql_base.h:267
#6  open_tables_for_query (thd=thd@entry=0x14f6dc000db8, tables=<optimized out>, table_count=table_count@entry=0x14f6dc0145e8, flags=flags@entry=0, prelocking_strategy=0x14f6dc014608) at /test/bb-10.10-MDEV-28883_dbg/sql/sql_base.cc:5718
#7  0x000055815470ff7d in Sql_cmd_dml::prepare (this=0x14f6dc0145d0, thd=0x14f6dc000db8) at /test/bb-10.10-MDEV-28883_dbg/sql/sql_select.cc:30565
#8  0x0000558154712015 in Sql_cmd_dml::execute (this=0x14f6dc0145d0, thd=0x14f6dc000db8) at /test/bb-10.10-MDEV-28883_dbg/sql/sql_select.cc:30627
#9  0x00005581546d61e0 in mysql_execute_command (thd=thd@entry=0x14f6dc000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/bb-10.10-MDEV-28883_dbg/sql/sql_parse.cc:4386
#10 0x00005581546c2fe5 in mysql_parse (thd=thd@entry=0x14f6dc000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14f740089460) at /test/bb-10.10-MDEV-28883_dbg/sql/sql_parse.cc:7797
#11 0x00005581546d053a in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14f6dc000db8, packet=packet@entry=0x14f6dc00b6e9 "UPDATE v SET a=0", packet_length=packet_length@entry=16, blocking=blocking@entry=true) at /test/bb-10.10-MDEV-28883_dbg/sql/sql_class.h:1364
#12 0x00005581546d2c47 in do_command (thd=0x14f6dc000db8, blocking=blocking@entry=true) at /test/bb-10.10-MDEV-28883_dbg/sql/sql_parse.cc:1405
#13 0x0000558154831ae4 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5581587e8928, put_in_cache=put_in_cache@entry=true) at /test/bb-10.10-MDEV-28883_dbg/sql/sql_connect.cc:1418
#14 0x0000558154831fed in handle_one_connection (arg=0x5581587e8928) at /test/bb-10.10-MDEV-28883_dbg/sql/sql_connect.cc:1312
#15 0x000014f75972d609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#16 0x000014f759319133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95



 Comments   
Comment by Roel Van de Paar [ 2022-07-26 ]

Reduced testcase further to:

CREATE TABLE t (a INT) ENGINE=MERGE;
CREATE VIEW v AS SELECT a FROM t;
UPDATE v SET a=0;

Please test any fixes with both.

Comment by Igor Babaev [ 2022-08-02 ]

A fix for this bug was pushed into bb-10.10-MDEV-28883

Generated at Thu Feb 08 10:06:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.