List:Commits« Previous MessageNext Message »
From:Jorgen Loland Date:February 6 2009 8:38am
Subject:bzr commit into mysql-6.0-backup branch (jorgen.loland:2761) Bug#38294
View as plain text  
#At file:///localhome/jl208045/mysql/mysql-6.0-backup-38294/

 2761 Jorgen Loland	2009-02-06
      Bug#38294 - Backup: server crash if no database set when issuing backup.
            
      Previously, backup crashed when called without setting a database first ('use db');
      making any database the active database was a workaround. The reason for this was bug
      38916 - "Select from I_S.ROUTINES results in "No database selected" error". 
      
      This patch contains a regression test for the originally reported problem.
modified:
  mysql-test/suite/backup/r/backup.result
  mysql-test/suite/backup/t/backup.test

per-file messages:
  mysql-test/suite/backup/r/backup.result
    Added test for backup run without any database selected.
  mysql-test/suite/backup/t/backup.test
    Added test for backup run without any database selected.
=== modified file 'mysql-test/suite/backup/r/backup.result'
--- a/mysql-test/suite/backup/r/backup.result	2009-02-05 17:20:38 +0000
+++ b/mysql-test/suite/backup/r/backup.result	2009-02-06 08:38:18 +0000
@@ -631,3 +631,17 @@ a	b
 5	2008-04-01 00:00:01
 DROP DATABASE IF EXISTS bup_delete;
 DROP DATABASE IF EXISTS bup_default;
+# 
+# Bug#38294 - Backup fails if no database selected.
+#
+CREATE DATABASE bup_usedb;
+CREATE FUNCTION bup_usedb.f1() RETURNS INT RETURN (SELECT 1);
+SHOW TABLES;
+ERROR 3D000: No database selected
+BACKUP DATABASE bup_usedb TO 'bup_usedb.bak';
+backup_id
+#
+DROP DATABASE bup_usedb;
+#
+# Cleanup
+#

=== modified file 'mysql-test/suite/backup/t/backup.test'
--- a/mysql-test/suite/backup/t/backup.test	2009-02-05 17:20:38 +0000
+++ b/mysql-test/suite/backup/t/backup.test	2009-02-06 08:38:18 +0000
@@ -534,6 +534,37 @@ DROP DATABASE IF EXISTS bup_delete;
 DROP DATABASE IF EXISTS bup_default;
 --enable_warnings
 
+--echo # 
+--echo # Bug#38294 - Backup fails if no database selected.
+--echo #
+
+CREATE DATABASE bup_usedb;
+CREATE FUNCTION bup_usedb.f1() RETURNS INT RETURN (SELECT 1);
+
+# The SHOW TABLES below is used to ensure that no database is
+# selected. If something changes to the other tests in this file so
+# that SHOW TABLES does not fail as expected, the following
+# create/use/drop sequence will result in the expected bahavior of no
+# database selected.
+
+# CREATE DATABASE dbuseme;
+# USE dbuseme;
+# DROP DATABASE dbuseme;
+
+--error ER_NO_DB_ERROR
+SHOW TABLES;
+
+# Calling backup without calling 'use db' first
+--replace_column 1 #
+BACKUP DATABASE bup_usedb TO 'bup_usedb.bak';
+
+DROP DATABASE bup_usedb;
+
+--echo #
+--echo # Cleanup
+--echo #
+
+--remove_file $MYSQLTEST_VARDIR/master-data/bup_usedb.bak
 --remove_file $MYSQLTEST_VARDIR/master-data/bup_delete.bak
 --remove_file $MYSQLTEST_VARDIR/master-data/bup_default_timestamp.bak
 --remove_file $MYSQLTEST_VARDIR/master-data/bup_default.bak

Thread
bzr commit into mysql-6.0-backup branch (jorgen.loland:2761) Bug#38294Jorgen Loland6 Feb