summaryrefslogtreecommitdiff
path: root/mysql-test/r/delete.result
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 /mysql-test/r/delete.result
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 'mysql-test/r/delete.result')
-rw-r--r--mysql-test/r/delete.result15
1 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index 702b9348b7d..5e4adbbd6dc 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -509,3 +509,18 @@ CREATE TABLE t3 LIKE t1;
DELETE FROM t1.*, test.t2.*, a.* USING t1, t2, t3 AS a;
DROP TABLE t1, t2, t3;
End of 5.1 tests
+#
+# Bug#51099 Assertion in mysql_multi_delete_prepare()
+#
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1, v2;
+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;
+DELETE FROM v2;
+ERROR HY000: Can not delete from join view 'test.v2'
+DELETE v2 FROM v2;
+ERROR HY000: Can not delete from join view 'test.v2'
+DROP VIEW v2, v1;
+DROP TABLE t1, t2;