[MDEV-10554] Assertion `!derived->first_select()->exclude_from_table_unique_test || derived->outer_select()-> exclude_from_table_unique_test' failed in TABLE_LIST::set_check_merged() Created: 2016-08-13  Updated: 2017-02-10  Resolved: 2017-02-10

Status: Closed
Project: MariaDB Server
Component/s: Views
Affects Version/s: 10.2
Fix Version/s: 10.2.4

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: 10.2-rc

Issue Links:
Relates
relates to MDEV-11363 Assertion `!derived->first_sel ect()-... Closed

 Description   

CREATE TABLE t (f INT);
CREATE ALGORITHM = TEMPTABLE VIEW v AS SELECT * FROM ( SELECT * FROM t ) AS sq;
 
PREPARE stmt FROM 'SELECT * FROM v';
EXECUTE stmt;
EXECUTE stmt;

mysqld: /data/src/10.2/sql/table.cc:5447: void TABLE_LIST::set_check_merged(): Assertion `!derived->first_select()->exclude_from_table_unique_test || derived->outer_select()-> exclude_from_table_unique_test' failed.
160813 18:24:47 [ERROR] mysqld got signal 6 ;

Stack trace from 10.2 commit 69052ed022063d0770ad4562a1dd42572067547e

#6  0x00007f65df094266 in __assert_fail_base (fmt=0x7f65df1cd238 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f65e2217e78 "!derived->first_select()->exclude_from_table_unique_test || derived->outer_select()-> exclude_from_table_unique_test", file=file@entry=0x7f65e2216bca "/data/src/10.2/sql/table.cc", line=line@entry=5447, function=function@entry=0x7f65e22194a0 <TABLE_LIST::set_check_merged()::__PRETTY_FUNCTION__> "void TABLE_LIST::set_check_merged()") at assert.c:92
#7  0x00007f65df094312 in __GI___assert_fail (assertion=0x7f65e2217e78 "!derived->first_select()->exclude_from_table_unique_test || derived->outer_select()-> exclude_from_table_unique_test", file=0x7f65e2216bca "/data/src/10.2/sql/table.cc", line=5447, function=0x7f65e22194a0 <TABLE_LIST::set_check_merged()::__PRETTY_FUNCTION__> "void TABLE_LIST::set_check_merged()") at assert.c:101
#8  0x00007f65e19ca4ed in TABLE_LIST::set_check_merged (this=0x7f65d63978d8) at /data/src/10.2/sql/table.cc:5445
#9  0x00007f65e19cfdc8 in TABLE_LIST::set_merged_derived (this=0x7f65d63978d8) at /data/src/10.2/sql/table.h:2283
#10 0x00007f65e19cf1f0 in TABLE_LIST::init_derived (this=0x7f65d63978d8, thd=0x7f65d6052070, init_view=true) at /data/src/10.2/sql/table.cc:7627
#11 0x00007f65e18a6ba2 in mysql_derived_init (thd=0x7f65d6052070, lex=0x7f65d6393090, derived=0x7f65d63978d8) at /data/src/10.2/sql/sql_derived.cc:570
#12 0x00007f65e18a5f64 in mysql_handle_derived (lex=0x7f65d6393090, phases=1) at /data/src/10.2/sql/sql_derived.cc:120
#13 0x00007f65e186fa60 in open_and_lock_tables (thd=0x7f65d6052070, options=..., tables=0x7f65d63947b8, derived=true, flags=0, prelocking_strategy=0x7f65e2849c20) at /data/src/10.2/sql/sql_base.cc:4586
#14 0x00007f65e1865095 in open_and_lock_tables (thd=0x7f65d6052070, tables=0x7f65d63947b8, derived=true, flags=0) at /data/src/10.2/sql/sql_base.h:497
#15 0x00007f65e18dc217 in execute_sqlcom_select (thd=0x7f65d6052070, all_tables=0x7f65d63947b8) at /data/src/10.2/sql/sql_parse.cc:6231
#16 0x00007f65e18d24f5 in mysql_execute_command (thd=0x7f65d6052070) at /data/src/10.2/sql/sql_parse.cc:3353
#17 0x00007f65e18fa976 in Prepared_statement::execute (this=0x7f65d6211470, expanded_query=0x7f65e284b1a0, open_cursor=false) at /data/src/10.2/sql/sql_prepare.cc:4277
#18 0x00007f65e18f97e7 in Prepared_statement::execute_loop (this=0x7f65d6211470, expanded_query=0x7f65e284b1a0, open_cursor=false, packet=0x0, packet_end=0x0) at /data/src/10.2/sql/sql_prepare.cc:3908
#19 0x00007f65e18f7854 in mysql_sql_stmt_execute (thd=0x7f65d6052070) at /data/src/10.2/sql/sql_prepare.cc:3036
#20 0x00007f65e18d2526 in mysql_execute_command (thd=0x7f65d6052070) at /data/src/10.2/sql/sql_parse.cc:3364
#21 0x00007f65e18dfe73 in mysql_parse (thd=0x7f65d6052070, rawbuf=0x7f65d611f088 "EXECUTE stmt", length=12, parser_state=0x7f65e284bde0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7742
#22 0x00007f65e18ce2df in dispatch_command (command=COM_QUERY, thd=0x7f65d6052070, packet=0x7f65d6115071 "EXECUTE stmt", packet_length=12, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1790
#23 0x00007f65e18ccd4b in do_command (thd=0x7f65d6052070) at /data/src/10.2/sql/sql_parse.cc:1353
#24 0x00007f65e1a05450 in do_handle_one_connection (connect=0x7f65de86d410) at /data/src/10.2/sql/sql_connect.cc:1354
#25 0x00007f65e1a051dd in handle_one_connection (arg=0x7f65de86d410) at /data/src/10.2/sql/sql_connect.cc:1260
#26 0x00007f65e1cf831c in pfs_spawn_thread (arg=0x7f65de8519f0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#27 0x00007f65e0f960a4 in start_thread (arg=0x7f65e284d300) at pthread_create.c:309
#28 0x00007f65df14e87d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111



 Comments   
Comment by Oleksandr Byelkin [ 2017-02-08 ]

It trys to merge view on the second execution!

Comment by Oleksandr Byelkin [ 2017-02-08 ]

no, it is real internal derived...

Comment by Oleksandr Byelkin [ 2017-02-08 ]

second execution do not init one of selects in reinit_stmt_before_use()

Comment by Oleksandr Byelkin [ 2017-02-09 ]

The problem is that as soon as on the first execution derived table unit excluded (because it is merged ) the check is not relevant because there will not be re-initialization of the unit which is excluded.

Comment by Oleksandr Byelkin [ 2017-02-09 ]

revision-id: 1f98633bb5386f84a58a5d1514a3681703b9dedf (mariadb-10.2.3-175-g1f98633)
parent(s): a75633b5bdd88a239b2227de237d2f23003d8ea8
committer: Oleksandr Byelkin
timestamp: 2017-02-09 12:08:57 +0100
message:

MDEV-10554: Assertion `!derived->first_select()>exclude_from_table_unique_test || derived>outer_select()-> exclude_from_table_unique_test' failed in TABLE_LIST::set_check_merged()

Mark and check excluded because of merging derived tables and views.

Comment by Oleksandr Byelkin [ 2017-02-09 ]

sent to buildbot as bb-10.2-MDEV-10554

Comment by Oleksandr Byelkin [ 2017-02-09 ]

in 10.1 it is prohibited to have derived in the view

Comment by Sergei Petrunia [ 2017-02-09 ]

Ok to push.

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