3749 Chaithra Gopalareddy 2012-03-14
Bug#12626844 : WE ARE NOT CHECKING VIEW TABLE NAMES
ENOUGH - CONCAT() HACKS. ALSO WRONG
ERROR MESSAGE WHILE TRYING TO CREATE
A VIEW ON A NON EXISTING DATABASE
PROBLEM:
The first part of the problem is concluded as not a
bug, as 'concat' is not a reserved word and it is
completely valid to create a view with the name
'concat'.
The second issue is, while trying to create a view on
a non existing database, we are not giving a proper error
message.
FIX:
We have added a check for the database existence while
trying to create a view. This check would give an error
as 'unknown database' when the database does not exist.
This patch is a backport of the patch for Bug#13601606
@ mysql-test/r/view.result
Added test case result of Bug#12626844
@ mysql-test/t/view.test
Added test case for Bug#12626844
@ sql/sql_view.cc
Added a check for database existence in mysql_create_view
modified:
mysql-test/r/view.result
mysql-test/t/view.test
sql/sql_view.cc
3748 Luis Soares 2012-03-12 [merge]
BUG#12400313
Automerging from mysql-5.1.
modified:
mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test
=== modified file 'mysql-test/r/view.result'
--- a/mysql-test/r/view.result 2011-04-08 08:09:24 +0000
+++ b/mysql-test/r/view.result 2012-03-14 00:57:03 +0000
@@ -4102,3 +4102,10 @@ UNLOCK TABLES;
# Connection default
DROP PROCEDURE p1;
DROP TABLE t1;
+#
+# Bug#12626844: WRONG ERROR MESSAGE WHILE CREATING A VIEW ON A
+# NON EXISTING DATABASE
+#
+DROP DATABASE IF EXISTS nodb;
+CREATE VIEW nodb.a AS SELECT 1;
+ERROR 42000: Unknown database 'nodb'
=== modified file 'mysql-test/t/view.test'
--- a/mysql-test/t/view.test 2011-04-08 08:09:24 +0000
+++ b/mysql-test/t/view.test 2012-03-14 00:57:03 +0000
@@ -4136,6 +4136,17 @@ disconnect con2;
disconnect con3;
+--echo #
+--echo # Bug#12626844: WRONG ERROR MESSAGE WHILE CREATING A VIEW ON A
+--echo # NON EXISTING DATABASE
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS nodb;
+--enable_warnings
+--error ER_BAD_DB_ERROR
+CREATE VIEW nodb.a AS SELECT 1;
+
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
=== modified file 'sql/sql_view.cc'
--- a/sql/sql_view.cc 2012-02-16 09:48:16 +0000
+++ b/sql/sql_view.cc 2012-03-14 00:57:03 +0000
@@ -444,6 +444,13 @@ bool mysql_create_view(THD *thd, TABLE_L
view= lex->unlink_first_table(&link_to_local);
+ if (check_db_dir_existence(view->db))
+ {
+ my_error(ER_BAD_DB_ERROR, MYF(0), view->db);
+ res= TRUE;
+ goto err;
+ }
+
if (mode == VIEW_ALTER && fill_defined_view_parts(thd, view))
{
res= TRUE;
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5 branch (chaithra.gopalareddy:3748 to 3749)Bug#12626844 | Chaithra Gopalareddy | 14 Mar |