Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-07-28 15:15:09+03:00, gkodinov@stripped +3 -0
Bug #11551: Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE
made DROP VIEW to continue on error and report an aggregated error
at its end. This makes it similar to DROP TABLE.
mysql-test/r/view.result@stripped, 2006-07-28 15:15:02+03:00, gkodinov@stripped +20 -1
Bug #11551: Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE
- test case
- changed error message
mysql-test/t/view.test@stripped, 2006-07-28 15:15:03+03:00, gkodinov@stripped +21 -0
Bug #11551: Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE
- test case
sql/sql_view.cc@stripped, 2006-07-28 15:15:04+03:00, gkodinov@stripped +33 -9
Bug #11551: Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE
- made DROP VIEW to continue on error and report an aggregated error
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: gkodinov
# Host: macbook.gmz
# Root: /Users/kgeorge/mysql/work/B11551-5.0-opt
--- 1.167/mysql-test/r/view.result 2006-07-28 15:15:25 +03:00
+++ 1.168/mysql-test/r/view.result 2006-07-28 15:15:25 +03:00
@@ -193,7 +193,7 @@ c d
2 5
3 10
drop view v100;
-ERROR 42S02: Unknown table 'test.v100'
+ERROR 42S02: Unknown table 'v100'
drop view t1;
ERROR HY000: 'test.t1' is not VIEW
drop table v1;
@@ -2820,3 +2820,22 @@ b
c
DROP VIEW v1, v2;
DROP TABLE t1;
+CREATE TABLE t1 (id INT);
+CREATE VIEW v1 AS SELECT id FROM t1;
+SHOW TABLES;
+Tables_in_test
+t1
+v1
+DROP VIEW v2,v1;
+ERROR 42S02: Unknown table 'v2'
+SHOW TABLES;
+Tables_in_test
+t1
+CREATE VIEW v1 AS SELECT id FROM t1;
+DROP VIEW t1,v1;
+ERROR HY000: 'test.t1' is not VIEW
+SHOW TABLES;
+Tables_in_test
+t1
+DROP TABLE t1;
+DROP VIEW IF EXISTS v1;
--- 1.152/mysql-test/t/view.test 2006-07-28 15:15:25 +03:00
+++ 1.153/mysql-test/t/view.test 2006-07-28 15:15:25 +03:00
@@ -2686,3 +2686,24 @@ INSERT INTO v2 (col) VALUES ('c');
SELECT s1 FROM t1;
DROP VIEW v1, v2;
DROP TABLE t1;
+
+#
+# Bug #11551: Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE
+#
+CREATE TABLE t1 (id INT);
+CREATE VIEW v1 AS SELECT id FROM t1;
+SHOW TABLES;
+
+--error 1051
+DROP VIEW v2,v1;
+SHOW TABLES;
+
+CREATE VIEW v1 AS SELECT id FROM t1;
+--error 1347
+DROP VIEW t1,v1;
+SHOW TABLES;
+
+DROP TABLE t1;
+--disable_warnings
+DROP VIEW IF EXISTS v1;
+--enable_warnings
--- 1.89/sql/sql_view.cc 2006-07-28 15:15:25 +03:00
+++ 1.90/sql/sql_view.cc 2006-07-28 15:15:25 +03:00
@@ -1228,6 +1228,9 @@ bool mysql_drop_view(THD *thd, TABLE_LIS
TABLE_LIST *view;
bool type= 0;
db_type not_used;
+ String wrong_views;
+ String wrong_object_db, wrong_object_name;
+ bool error= FALSE;
for (view= views; view; view= view->next_local)
{
@@ -1249,24 +1252,45 @@ bool mysql_drop_view(THD *thd, TABLE_LIS
continue;
}
if (type)
- my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->table_name, "VIEW");
+ {
+ if (!wrong_object_name.length())
+ {
+ wrong_object_db.append(String(view->db,system_charset_info));
+ wrong_object_name.append(String(view->table_name,system_charset_info));
+ }
+ }
else
- my_error(ER_BAD_TABLE_ERROR, MYF(0), name);
- goto err;
+ {
+ if (wrong_views.length())
+ wrong_views.append(',');
+ wrong_views.append(String(view->table_name,system_charset_info));
+ }
+ VOID(pthread_mutex_unlock(&LOCK_open));
+ continue;
}
if (my_delete(path, MYF(MY_WME)))
- goto err;
+ error= TRUE;
query_cache_invalidate3(thd, view, 0);
sp_cache_invalidate();
VOID(pthread_mutex_unlock(&LOCK_open));
}
+ if (error)
+ {
+ DBUG_RETURN(TRUE);
+ }
+ else if (wrong_object_name.length())
+ {
+ my_error(ER_WRONG_OBJECT, MYF(0), wrong_object_db.c_ptr(),
+ wrong_object_name.c_ptr(), "VIEW");
+ DBUG_RETURN(TRUE);
+ }
+ else if (wrong_views.length())
+ {
+ my_error(ER_BAD_TABLE_ERROR, MYF(0), wrong_views.c_ptr());
+ DBUG_RETURN(TRUE);
+ }
send_ok(thd);
DBUG_RETURN(FALSE);
-
-err:
- VOID(pthread_mutex_unlock(&LOCK_open));
- DBUG_RETURN(TRUE);
-
}
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2222) BUG#11551 | kgeorge | 28 Jul |