Bug #51099 | Assertion in mysql_multi_delete_prepare() | ||
---|---|---|---|
Submitted: | 11 Feb 2010 14:16 | Modified: | 16 Nov 2010 2:36 |
Reporter: | Philip Stoev | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S2 (Serious) |
Version: | 5.1, 5.5 | OS: | Any |
Assigned to: | Jon Olav Hauglid | CPU Architecture: | Any |
[11 Feb 2010 14:16]
Philip Stoev
[11 Feb 2010 14:29]
Philip Stoev
Core and binary: http://mysql-systemqa.s3.amazonaws.com/var-bug51099.zip Source: revision-id: alik@sun.com-20100210163134-wuz4fea0hcwgdijm date: 2010-02-10 19:31:34 +0300 build-date: 2010-02-11 14:05:09 +0200 revno: 3089 branch-nick: mysql-next-4284
[15 May 2010 8:59]
Philip Stoev
Unfortunately, this is not readily repeatable. Setting this to Verified so that a fix attempt can be made based on core file. If this is not possible, please set to "Can't Repeat". Thanks.
[18 May 2010 22:39]
Omer Barnir
triage: setting to SR55RC assuming information is sufficient as verified. If more information will need to be re-triaged
[19 May 2010 13:47]
Jon Olav Hauglid
Unable to reproduce with mysql-trunk-runtime (5.5.5-m3). Closing as "Can't repeat". Please reopen the bug if the assertion is seen again.
[26 May 2010 12:03]
Matthias Leich
I just replayed this problem on mysql-next-mr-wl3561 which is mysql-next-mr ~ End of April 2010 + wl3561 Therefor I set this bug to "Analyzing".
[16 Aug 2010 14:10]
Jon Olav Hauglid
Updated stack trace from mysql-5.5-runtime-stage: #6 0x00007faa38165941 in *__GI___assert_fail ( assertion=0xc16128 "target_tbl->correspondent_table->view && target_tbl->correspondent_table->merge_underlying_list && target_tbl->correspondent_table->merge_underlying_list-> next_local", file=<value optimized out>, line=530, function=0xc16440 "int mysql_multi_delete_prepare(THD*)") at assert.c:81 #7 0x0000000000869b78 in mysql_multi_delete_prepare (thd=0x7faa1c18b530) at /export/home/x/mysql-5.5-runtime-stage-test/sql/sql_delete.cc:530 #8 0x00000000005dea68 in mysql_execute_command (thd=0x7faa1c18b530) at /export/home/x/mysql-5.5-runtime-stage-test/sql/sql_parse.cc:3373 #9 0x00000000005e59ac in mysql_parse (thd=0x7faa1c18b530, rawbuf=0x2e887f0 "DELETE QUICK A , B FROM testdb_S . t1_view2_S AS A NATURAL JOIN testdb_N . t1_view2_N B WHERE testdb_N . f1_1_N () = 1 AND `pk` = 2", length=136, parser_state=0x7faa29f40130) (gdb) p target_tbl->correspondent_table->view $2 = (st_lex_local *) 0x2e9ea00 (gdb) p target_tbl->correspondent_table->merge_underlying_list $3 = (TABLE_LIST *) 0x2bc3230 (gdb) p target_tbl->correspondent_table->merge_underlying_list->next_local $4 = (TABLE_LIST *) 0x0
[21 Sep 2010 13:55]
Jon Olav Hauglid
MTR test case: CREATE TABLE t1(a INT); CREATE TABLE t2(b INT); CREATE VIEW v1 AS SELECT a, b FROM t1, t2; CREATE VIEW v2 AS SELECT a FROM v1; # This triggers the assert. DELETE v2 FROM v2; Using this test case, the bug is repeatable on 5.1 as well.
[27 Sep 2010 12:19]
Matthias Leich
Some additional observation: If I replace the DELETE v2 FROM v2; by DELETE FROM v2; I get query 'DELETE FROM v2' failed: 1395: Can not delete from join view 'test.v2'
[27 Sep 2010 15:33]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/119182 3146 Jon Olav Hauglid 2010-09-27 Bug #51099 Assertion in mysql_multi_delete_prepare() This assert was triggered if DELETE was done on a view that referenced another view which in turn (directly or indirectly) referenced more than one table. Delete from a view referencing more than one table (a join view) is not supported and is supposed to give ER_VIEW_DELETE_MERGE_VIEW error. Before this error was reported from the multi table delete code, an assert verified that the view from the DELETE statement had more than one underlying table. However, this assert did not take into account that the view could refer to another view which in turn referenced the actual tables. This patch fixes the problem by adjusting the assert to only verify that we are trying to insert into a view, rather than also try to verify there are more than one underlying table. This problem was only noticeable on debug builds of the server. On release builds, ER_VIEW_DELETE_MERGE_VIEW was correctly reported. Test case added to delete.test.
[4 Oct 2010 8:27]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/119788 3151 Jon Olav Hauglid 2010-10-04 Bug #51099 Assertion in mysql_multi_delete_prepare() This assert was triggered if DELETE was done on a view that referenced another view which in turn (directly or indirectly) referenced more than one table. Delete from a view referencing more than one table (a join view) is not supported and is supposed to give ER_VIEW_DELETE_MERGE_VIEW error. Before this error was reported from the multi table delete code, an assert verified that the view from the DELETE statement had more than one underlying table. However, this assert did not take into account that the view could refer to another view which in turn referenced the actual tables. This patch fixes the problem by adjusting the assert to take this possibility into account. This problem was only noticeable on debug builds of the server. On release builds, ER_VIEW_DELETE_MERGE_VIEW was correctly reported. Test case added to delete.test.
[4 Oct 2010 8:29]
Jon Olav Hauglid
Pushed to mysql-5.5-runtime (5.5.7-rc).
[9 Nov 2010 19:49]
Bugs System
Pushed into mysql-5.5 5.5.7-rc (revid:sunanda.menon@sun.com-20101109182959-otkxq8vo2dcd13la) (version source revid:sunanda.menon@sun.com-20101109182959-otkxq8vo2dcd13la) (merge vers: 5.5.7-rc) (pib:21)
[13 Nov 2010 16:21]
Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:alexander.nozdrin@oracle.com-20101113152450-2zzcm50e7i4j35v7) (merge vers: 5.6.1-m4) (pib:21)
[13 Nov 2010 16:42]
Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101113160336-atmtmfb3mzm4pz4i) (version source revid:vasil.dimov@oracle.com-20100629074804-359l9m9gniauxr94) (pib:21)
[16 Nov 2010 2:36]
Paul DuBois
Noted in 5.5.7 changelog. An assertion could be raised by DELETE on a view that referenced another view which in turn (directly or indirectly) referenced more than one table.