List:Commits« Previous MessageNext Message »
From:Raghav Kapoor Date:January 23 2012 12:09pm
Subject:bzr push into mysql-trunk branch (raghav.kapoor:3765 to 3766) Bug#13601606
View as plain text  
 3766 Raghav Kapoor	2012-01-23
      BUG#13601606 - FAILED VIEW CREATION ERROR MESSAGE (FOR DB NOT PRESENT) 
                     NEEDS BIG IMPROVEMENT
      
      BACKGROUND:
      Trying to create a view in a non-existent database gave the 
      error "Can't create/write to file ..." which does not really 
      describe the reason for the failure and is also different 
      from how the similar problem is reported for CREATE TABLE. 
      
      FIX:
      This bug is fixed by reporting ER_BAD_DB_ERROR "Unknown 
      database ..." when trying to create a view in a non-existent
      database.This is the same error already reported by CREATE 
      TABLE. A test case has been written and corresponding result 
      file has been updated.

    modified:
      mysql-test/r/view.result
      mysql-test/t/view.test
      sql/sql_view.cc
 3765 Alexander Barkov	2012-01-23 [merge]
      Merging from mysql-trunk

    modified:
      storage/innobase/dict/dict0load.cc
      storage/innobase/handler/ha_innodb.cc
=== modified file 'mysql-test/r/view.result'
--- a/mysql-test/r/view.result	2012-01-10 18:58:10 +0000
+++ b/mysql-test/r/view.result	2012-01-23 10:52:59 +0000
@@ -4138,3 +4138,10 @@ CREATE TEMPORARY TABLE t1 (a INT) engine
 CREATE VIEW t1 AS SELECT 1;
 DROP VIEW t1;
 DROP TEMPORARY TABLE t1;
+#
+# Bug#13601606: FAILED VIEW CREATION ERROR MESSAGE (FOR DB NOT PRESENT) 
+#               NEEDS BIG IMPROVEMENT 
+#
+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-12-09 08:59:22 +0000
+++ b/mysql-test/t/view.test	2012-01-23 10:52:59 +0000
@@ -4227,6 +4227,18 @@ DROP VIEW t1;
 DROP TEMPORARY TABLE t1;
 
 
+--echo #
+--echo # Bug#13601606: FAILED VIEW CREATION ERROR MESSAGE (FOR DB NOT PRESENT) 
+--echo #               NEEDS BIG IMPROVEMENT 
+--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	2011-12-19 11:42:11 +0000
+++ b/sql/sql_view.cc	2012-01-23 10:52:59 +0000
@@ -455,6 +455,16 @@ bool mysql_create_view(THD *thd, TABLE_L
     goto err;
   }
 
+  /*
+    Checking the existence of the database in which the view is to be created
+  */
+  if (check_db_dir_existence(view->db))
+  {
+    my_error(ER_BAD_DB_ERROR, MYF(0), view->db);
+    res= TRUE;
+    goto err;
+  }
+
   view= lex->unlink_first_table(&link_to_local);
 
   if (mode == VIEW_ALTER && fill_defined_view_parts(thd, view))

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (raghav.kapoor:3765 to 3766) Bug#13601606Raghav Kapoor23 Jan