summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@oracle.com>2010-10-04 10:25:04 +0200
committerJon Olav Hauglid <jon.hauglid@oracle.com>2010-10-04 10:25:04 +0200
commit7a64d43ad091bcc7e140a1c7b5cb49158e25a801 (patch)
tree36cc0ae2f85c40b60ac4114a7f607a88fdebe886 /sql
parent476939cb457d8767e234faa3804322333b0e1c59 (diff)
downloadmariadb-git-7a64d43ad091bcc7e140a1c7b5cb49158e25a801.tar.gz
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.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_delete.cc4
1 files changed, 1 insertions, 3 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 2f69bac917e..685ce1c7b42 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -525,9 +525,7 @@ int mysql_multi_delete_prepare(THD *thd)
if (!(target_tbl->table= target_tbl->correspondent_table->table))
{
DBUG_ASSERT(target_tbl->correspondent_table->view &&
- target_tbl->correspondent_table->merge_underlying_list &&
- target_tbl->correspondent_table->merge_underlying_list->
- next_local);
+ target_tbl->correspondent_table->multitable_view);
my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0),
target_tbl->correspondent_table->view_db.str,
target_tbl->correspondent_table->view_name.str);