List:Commits« Previous MessageNext Message »
From:Jorgen Loland Date:March 4 2009 10:03am
Subject:bzr commit into mysql-6.0-backup branch (jorgen.loland:2784) Bug#39063
View as plain text  
#At file:///localhome/jl208045/mysql/mysql-6.0-backup-39063/

 2784 Jorgen Loland	2009-03-04
      Bug#39063 - Online Backup: Backup behavior changes with the case used for the database name
      
      Before, the database list for BACKUP was case sensitive. This caused problems in case insensitive servers because database 'X' and 'x' is considered the same database while backup would fail if the wrong case was used.
      
      With this patch, the database names are converted to lower case when BACKUP is executed on a case insensitive server.
added:
  mysql-test/suite/backup/r/backup_dbname.result
  mysql-test/suite/backup/r/backup_dbname_notwin.result
  mysql-test/suite/backup/t/backup_dbname-master.opt
  mysql-test/suite/backup/t/backup_dbname.test
  mysql-test/suite/backup/t/backup_dbname_notwin.test
modified:
  mysql-test/suite/backup/r/backup_errors.result
  mysql-test/suite/backup/r/backup_errors_compression.result
  mysql-test/suite/backup/t/backup_errors.test
  sql/backup/backup_info.cc
  sql/si_objects.cc
  sql/sql_lex.cc

per-file messages:
  mysql-test/suite/backup/r/backup_dbname.result
    Test BACKUP with different database name cases (upper/lower) in a case insensitive server.
  mysql-test/suite/backup/r/backup_dbname_notwin.result
    Test BACKUP with different database name cases (upper/lower) in a case sensitive server.
  mysql-test/suite/backup/r/backup_errors.result
    Make test reflect minor changes to how non-unique database names in BACKUP command works.
  mysql-test/suite/backup/r/backup_errors_compression.result
    Make test reflect minor changes to how non-unique database names in BACKUP command works.
  mysql-test/suite/backup/t/backup_dbname-master.opt
    Make the server case insensitive for this test
  mysql-test/suite/backup/t/backup_dbname.test
    Test BACKUP with different database name cases (upper/lower) in a case insensitive server.
  mysql-test/suite/backup/t/backup_dbname_notwin.test
    Test BACKUP with different database name cases (upper/lower) in a case sensitive server.
  mysql-test/suite/backup/t/backup_errors.test
    Make test reflect minor changes to how non-unique database names in BACKUP command works.
  sql/backup/backup_info.cc
    Error if database name list to the BACKUP command contains non-unique names.
  sql/si_objects.cc
    Convert database name to lower case if the server is case insensitive.
  sql/sql_lex.cc
    Remove check of unique database name for BACKUP command. This check is now performed in backup_info.cc.
=== added file 'mysql-test/suite/backup/r/backup_dbname.result'
--- a/mysql-test/suite/backup/r/backup_dbname.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/r/backup_dbname.result	2009-03-04 10:02:58 +0000
@@ -0,0 +1,207 @@
+#
+# Create two database:
+#  * 1 with lower-case name "lower"
+#  * 1 with upper-case name "UPPER"
+#
+# (Not supposed to be same name)
+DROP DATABASE IF EXISTS lower;
+DROP DATABASE IF EXISTS UPPER;
+# Creating database with lower-case name
+CREATE DATABASE lower;
+CREATE TABLE lower.lcase (a char(10), b char(10));
+INSERT INTO lower.lcase VALUES ('L41','1300'),
+('L01','1453'), 
+('L00','1000'),
+('L41','1301'),
+('L41','1305');
+# Creating database with upper-case name
+CREATE DATABASE UPPER;
+CREATE TABLE UPPER.ucase (a char(10), b char(10));
+INSERT INTO UPPER.ucase VALUES ('U41','1300'),
+('U01','1453'), 
+('U00','1000'),
+('U41','1301'),
+('U41','1305');
+
+# BACKUP lower-case database
+BACKUP DATABASE lower to 'lowlow.bup';
+backup_id
+#
+
+# BACKUP lower-case database using upper-case name
+BACKUP DATABASE LOWER to 'lowup.bup';
+backup_id
+#
+
+# BACKUP upper-case database
+BACKUP DATABASE UPPER to 'upup.bup';
+backup_id
+#
+
+# BACKUP upper-case database using lower-case name
+BACKUP DATABASE upper to 'uplow.bup';
+backup_id
+#
+
+# BACKUP both database using only lower-case name
+BACKUP DATABASE upper, lower to 'bothcases.bup';
+backup_id
+#
+#
+# Print contents of the databases
+#
+#    Lower case database:
+#
+SHOW TABLES IN lower;
+Tables_in_lower
+lcase
+SELECT * FROM lower.lcase;
+a	b
+L41	1300
+L01	1453
+L00	1000
+L41	1301
+L41	1305
+#
+#    Upper case database:
+#
+SHOW TABLES IN UPPER;
+Tables_in_upper
+ucase
+SELECT * FROM UPPER.ucase;
+a	b
+U41	1300
+U01	1453
+U00	1000
+U41	1301
+U41	1305
+#
+# Drop the databases
+#
+DROP DATABASE lower;
+DROP DATABASE UPPER;
+#
+# RESTORE databases with correct case
+#
+# RESTORE lower case database and verify content
+#
+RESTORE FROM 'lowlow.bup';
+backup_id
+#
+
+SHOW TABLES IN lower;
+Tables_in_lower
+lcase
+SELECT * FROM lower.lcase;
+a	b
+L41	1300
+L01	1453
+L00	1000
+L41	1301
+L41	1305
+#
+# RESTORE upper case database and verify content
+#
+RESTORE FROM 'upup.bup';
+backup_id
+#
+
+SHOW TABLES IN UPPER;
+Tables_in_upper
+ucase
+SELECT * FROM UPPER.ucase;
+a	b
+U41	1300
+U01	1453
+U00	1000
+U41	1301
+U41	1305
+#
+# Drop the databases
+#
+DROP DATABASE lower;
+DROP DATABASE UPPER;
+#
+# RESTORE databases with inverted case
+#
+# RESTORE lower case database and verify content
+#
+RESTORE FROM 'lowup.bup';
+backup_id
+#
+
+SHOW TABLES IN lower;
+Tables_in_lower
+lcase
+SELECT * FROM lower.lcase;
+a	b
+L41	1300
+L01	1453
+L00	1000
+L41	1301
+L41	1305
+#
+# RESTORE upper case database and verify content
+#
+RESTORE FROM 'uplow.bup';
+backup_id
+#
+
+SHOW TABLES IN UPPER;
+Tables_in_upper
+ucase
+SELECT * FROM UPPER.ucase;
+a	b
+U41	1300
+U01	1453
+U00	1000
+U41	1301
+U41	1305
+#
+# Drop the databases
+#
+DROP DATABASE lower;
+DROP DATABASE UPPER;
+#
+# RESTORE backup image with both databases and verify content
+#
+RESTORE FROM 'bothcases.bup';
+backup_id
+#
+
+SHOW TABLES IN lower;
+Tables_in_lower
+lcase
+SELECT * FROM lower.lcase;
+a	b
+L41	1300
+L01	1453
+L00	1000
+L41	1301
+L41	1305
+
+SHOW TABLES IN UPPER;
+Tables_in_upper
+ucase
+SELECT * FROM UPPER.ucase;
+a	b
+U41	1300
+U01	1453
+U00	1000
+U41	1301
+U41	1305
+#
+# Verify that BACKUP errors if the same database is written twice, 
+# but with different case
+#
+BACKUP DATABASE upper, UPPER to 'notunique.bup';
+ERROR 42000: Not unique database: 'upper'
+SHOW WARNINGS;
+Level	Code	Message
+Error	1753	Not unique database: 'upper'
+Warning	1763	Operation aborted
+#
+# CLEANUP
+#
+DROP DATABASE lower;
+DROP DATABASE UPPER;

=== added file 'mysql-test/suite/backup/r/backup_dbname_notwin.result'
--- a/mysql-test/suite/backup/r/backup_dbname_notwin.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/r/backup_dbname_notwin.result	2009-03-04 10:02:58 +0000
@@ -0,0 +1,143 @@
+#
+# Create two database:
+#  * 1 with lower-case name "backupcasetest"
+#  * 1 with upper-case name "BACKUPCASETEST"
+#
+DROP DATABASE IF EXISTS backupcasetest;
+DROP DATABASE IF EXISTS BACKUPCASETEST;
+# Creating database with lower-case name
+CREATE DATABASE backupcasetest;
+CREATE TABLE backupcasetest.lcase (a char(10), b char(10));
+INSERT INTO backupcasetest.lcase VALUES ('L41','1300'),
+('L01','1453'), 
+('L00','1000'),
+('L41','1301'),
+('L41','1305');
+# Creating database with upper-case name
+CREATE DATABASE BACKUPCASETEST;
+CREATE TABLE BACKUPCASETEST.ucase (a char(10), b char(10));
+INSERT INTO BACKUPCASETEST.ucase VALUES ('U41','1300'),
+('U01','1453'), 
+('U00','1000'),
+('U41','1301'),
+('U41','1305');
+
+# BACKUP lower-case database
+BACKUP DATABASE backupcasetest to 'lcase.bup';
+backup_id
+#
+
+# BACKUP upper-case database
+BACKUP DATABASE BACKUPCASETEST to 'ucase.bup';
+backup_id
+#
+
+# BACKUP both database
+BACKUP DATABASE BACKUPCASETEST, backupcasetest to 'bothcases.bup';
+backup_id
+#
+#
+# Print contents of the databases
+#
+#    Lower case database:
+#
+SHOW TABLES IN backupcasetest;
+Tables_in_backupcasetest
+lcase
+SELECT * FROM backupcasetest.lcase;
+a	b
+L41	1300
+L01	1453
+L00	1000
+L41	1301
+L41	1305
+#
+#    Upper case database:
+#
+SHOW TABLES IN BACKUPCASETEST;
+Tables_in_BACKUPCASETEST
+ucase
+SELECT * FROM BACKUPCASETEST.ucase;
+a	b
+U41	1300
+U01	1453
+U00	1000
+U41	1301
+U41	1305
+#
+# Drop the databases
+#
+DROP DATABASE backupcasetest;
+DROP DATABASE BACKUPCASETEST;
+#
+# RESTORE lower case database and verify content
+#
+RESTORE FROM 'lcase.bup';
+backup_id
+#
+
+SHOW TABLES IN backupcasetest;
+Tables_in_backupcasetest
+lcase
+SELECT * FROM backupcasetest.lcase;
+a	b
+L41	1300
+L01	1453
+L00	1000
+L41	1301
+L41	1305
+#
+# RESTORE upper case database and verify content
+#
+RESTORE FROM 'ucase.bup';
+backup_id
+#
+
+SHOW TABLES IN BACKUPCASETEST;
+Tables_in_BACKUPCASETEST
+ucase
+SELECT * FROM BACKUPCASETEST.ucase;
+a	b
+U41	1300
+U01	1453
+U00	1000
+U41	1301
+U41	1305
+#
+# Drop the databases
+#
+DROP DATABASE backupcasetest;
+DROP DATABASE BACKUPCASETEST;
+#
+# RESTORE backup image with both databases and verify content
+#
+RESTORE FROM 'bothcases.bup';
+backup_id
+#
+
+SHOW TABLES IN backupcasetest;
+Tables_in_backupcasetest
+lcase
+SELECT * FROM backupcasetest.lcase;
+a	b
+L41	1300
+L01	1453
+L00	1000
+L41	1301
+L41	1305
+
+SHOW TABLES IN BACKUPCASETEST;
+Tables_in_BACKUPCASETEST
+ucase
+SELECT * FROM BACKUPCASETEST.ucase;
+a	b
+U41	1300
+U01	1453
+U00	1000
+U41	1301
+U41	1305
+#
+# CLEANUP
+#
+DROP DATABASE backupcasetest;
+DROP DATABASE BACKUPCASETEST;

=== modified file 'mysql-test/suite/backup/r/backup_errors.result'
--- a/mysql-test/suite/backup/r/backup_errors.result	2009-02-20 00:04:53 +0000
+++ b/mysql-test/suite/backup/r/backup_errors.result	2009-03-04 10:02:58 +0000
@@ -112,17 +112,30 @@ running
 Unknown database 'foo,bar'
 error
 PURGE BACKUP LOGS;
+CREATE DATABASE foo;
+CREATE DATABASE bar;
+# 
 # repeated database
-BACKUP DATABASE foo,test,bar,foo TO 'test.bak' ;
+# 
+BACKUP DATABASE foo, bar, foo TO 'test.bak' ;
 ERROR 42000: Not unique database: 'foo'
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Not unique database: 'foo'
+Warning	#	Operation aborted
 verify backup history and progress logs for backup_state.
 SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
 backup_state	operation	backup_file	command
+error	backup	test.bak	BACKUP DATABASE foo, bar, foo TO 'test.bak'
 SELECT notes FROM mysql.backup_progress;
 notes
+starting
+running
+Not unique database: 'foo'
+error
+DROP DATABASE foo;
+DROP DATABASE bar;
+PURGE BACKUP LOGS;
 use adb;
 create table t1 (a int);
 create procedure p1() backup database test to 'test.bak';

=== modified file 'mysql-test/suite/backup/r/backup_errors_compression.result'
--- a/mysql-test/suite/backup/r/backup_errors_compression.result	2009-02-20 00:04:53 +0000
+++ b/mysql-test/suite/backup/r/backup_errors_compression.result	2009-03-04 10:02:58 +0000
@@ -112,17 +112,30 @@ running
 Unknown database 'foo,bar'
 error
 PURGE BACKUP LOGS;
+CREATE DATABASE foo;
+CREATE DATABASE bar;
+# 
 # repeated database
-BACKUP DATABASE foo,test,bar,foo TO 'test.bak' WITH COMPRESSION;
+# 
+BACKUP DATABASE foo, bar, foo TO 'test.bak' WITH COMPRESSION;
 ERROR 42000: Not unique database: 'foo'
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Not unique database: 'foo'
+Warning	#	Operation aborted
 verify backup history and progress logs for backup_state.
 SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
 backup_state	operation	backup_file	command
+error	backup	test.bak	BACKUP DATABASE foo, bar, foo TO 'test.bak' WITH COMPRESSION
 SELECT notes FROM mysql.backup_progress;
 notes
+starting
+running
+Not unique database: 'foo'
+error
+DROP DATABASE foo;
+DROP DATABASE bar;
+PURGE BACKUP LOGS;
 use adb;
 create table t1 (a int);
 create procedure p1() backup database test to 'test.bak';

=== added file 'mysql-test/suite/backup/t/backup_dbname-master.opt'
--- a/mysql-test/suite/backup/t/backup_dbname-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_dbname-master.opt	2009-03-04 10:02:58 +0000
@@ -0,0 +1 @@
+--lower_case_table_names=1

=== added file 'mysql-test/suite/backup/t/backup_dbname.test'
--- a/mysql-test/suite/backup/t/backup_dbname.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_dbname.test	2009-03-04 10:02:58 +0000
@@ -0,0 +1,178 @@
+#
+# Test BACKUP/RESTORE on case-insensitive servers. In this
+# environment, databases 'X' and 'x' are the same database. The
+# database name case used in the BACKUP command should not make a
+# difference.
+#
+
+--source include/not_embedded.inc
+
+--echo #
+--echo # Create two database:
+--echo #  * 1 with lower-case name "lower"
+--echo #  * 1 with upper-case name "UPPER"
+--echo #
+--echo # (Not supposed to be same name)
+
+--disable_warnings
+DROP DATABASE IF EXISTS lower;
+DROP DATABASE IF EXISTS UPPER;
+--enable_warnings
+
+--echo # Creating database with lower-case name
+CREATE DATABASE lower;
+CREATE TABLE lower.lcase (a char(10), b char(10));
+INSERT INTO lower.lcase VALUES ('L41','1300'),
+                                        ('L01','1453'), 
+                                        ('L00','1000'),
+                                        ('L41','1301'),
+                                        ('L41','1305');
+
+--echo # Creating database with upper-case name
+CREATE DATABASE UPPER;
+CREATE TABLE UPPER.ucase (a char(10), b char(10));
+INSERT INTO UPPER.ucase VALUES ('U41','1300'),
+                                        ('U01','1453'), 
+                                        ('U00','1000'),
+                                        ('U41','1301'),
+                                        ('U41','1305');
+
+--echo
+--echo # BACKUP lower-case database
+--replace_column 1 #
+BACKUP DATABASE lower to 'lowlow.bup';
+
+--echo
+--echo # BACKUP lower-case database using upper-case name
+--replace_column 1 #
+BACKUP DATABASE LOWER to 'lowup.bup';
+
+--echo
+--echo # BACKUP upper-case database
+--replace_column 1 #
+BACKUP DATABASE UPPER to 'upup.bup';
+
+--echo
+--echo # BACKUP upper-case database using lower-case name
+--replace_column 1 #
+BACKUP DATABASE upper to 'uplow.bup';
+
+--echo
+--echo # BACKUP both database using only lower-case name
+--replace_column 1 #
+BACKUP DATABASE upper, lower to 'bothcases.bup';
+
+--echo #
+--echo # Print contents of the databases
+--echo #
+--echo #    Lower case database:
+--echo #
+
+SHOW TABLES IN lower;
+SELECT * FROM lower.lcase;
+
+--echo #
+--echo #    Upper case database:
+--echo #
+
+SHOW TABLES IN UPPER;
+SELECT * FROM UPPER.ucase;
+
+--echo #
+--echo # Drop the databases
+--echo #
+DROP DATABASE lower;
+DROP DATABASE UPPER;
+
+--echo #
+--echo # RESTORE databases with correct case
+--echo #
+--echo # RESTORE lower case database and verify content
+--echo #
+--replace_column 1 #
+RESTORE FROM 'lowlow.bup';
+
+--echo
+SHOW TABLES IN lower;
+SELECT * FROM lower.lcase;
+
+--echo #
+--echo # RESTORE upper case database and verify content
+--echo #
+--replace_column 1 #
+RESTORE FROM 'upup.bup';
+
+--echo
+SHOW TABLES IN UPPER;
+SELECT * FROM UPPER.ucase;
+
+--echo #
+--echo # Drop the databases
+--echo #
+DROP DATABASE lower;
+DROP DATABASE UPPER;
+
+--echo #
+--echo # RESTORE databases with inverted case
+--echo #
+--echo # RESTORE lower case database and verify content
+--echo #
+--replace_column 1 #
+RESTORE FROM 'lowup.bup';
+
+--echo
+SHOW TABLES IN lower;
+SELECT * FROM lower.lcase;
+
+--echo #
+--echo # RESTORE upper case database and verify content
+--echo #
+--replace_column 1 #
+RESTORE FROM 'uplow.bup';
+
+--echo
+SHOW TABLES IN UPPER;
+SELECT * FROM UPPER.ucase;
+
+--echo #
+--echo # Drop the databases
+--echo #
+DROP DATABASE lower;
+DROP DATABASE UPPER;
+
+--echo #
+--echo # RESTORE backup image with both databases and verify content
+--echo #
+--replace_column 1 #
+RESTORE FROM 'bothcases.bup';
+
+--echo
+SHOW TABLES IN lower;
+SELECT * FROM lower.lcase;
+
+--echo
+SHOW TABLES IN UPPER;
+SELECT * FROM UPPER.ucase;
+
+--echo #
+--echo # Verify that BACKUP errors if the same database is written twice, 
+--echo # but with different case
+--echo #
+
+--error ER_NONUNIQ_DB
+BACKUP DATABASE upper, UPPER to 'notunique.bup';
+SHOW WARNINGS;
+
+--echo #
+--echo # CLEANUP
+--echo #
+DROP DATABASE lower;
+DROP DATABASE UPPER;
+
+let $MYSQLD_DATADIR = `select @@datadir`;
+--remove_file $MYSQLD_DATADIR/lowlow.bup
+--remove_file $MYSQLD_DATADIR/upup.bup
+--remove_file $MYSQLD_DATADIR/lowup.bup
+--remove_file $MYSQLD_DATADIR/uplow.bup
+--remove_file $MYSQLD_DATADIR/bothcases.bup
+

=== added file 'mysql-test/suite/backup/t/backup_dbname_notwin.test'
--- a/mysql-test/suite/backup/t/backup_dbname_notwin.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_dbname_notwin.test	2009-03-04 10:02:58 +0000
@@ -0,0 +1,126 @@
+#
+# Test BACKUP/RESTORE on case-sensitive servers. In this environment,
+# databases 'X' and 'x' are two different databases that can be backed
+# up and restore independently.
+#
+
+--source include/not_embedded.inc
+--source include/not_windows.inc
+
+--echo #
+--echo # Create two database:
+--echo #  * 1 with lower-case name "backupcasetest"
+--echo #  * 1 with upper-case name "BACKUPCASETEST"
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS backupcasetest;
+DROP DATABASE IF EXISTS BACKUPCASETEST;
+--enable_warnings
+
+--echo # Creating database with lower-case name
+CREATE DATABASE backupcasetest;
+CREATE TABLE backupcasetest.lcase (a char(10), b char(10));
+INSERT INTO backupcasetest.lcase VALUES ('L41','1300'),
+                                        ('L01','1453'), 
+                                        ('L00','1000'),
+                                        ('L41','1301'),
+                                        ('L41','1305');
+
+--echo # Creating database with upper-case name
+CREATE DATABASE BACKUPCASETEST;
+CREATE TABLE BACKUPCASETEST.ucase (a char(10), b char(10));
+INSERT INTO BACKUPCASETEST.ucase VALUES ('U41','1300'),
+                                        ('U01','1453'), 
+                                        ('U00','1000'),
+                                        ('U41','1301'),
+                                        ('U41','1305');
+
+--echo
+--echo # BACKUP lower-case database
+--replace_column 1 #
+BACKUP DATABASE backupcasetest to 'lcase.bup';
+
+--echo
+--echo # BACKUP upper-case database
+--replace_column 1 #
+BACKUP DATABASE BACKUPCASETEST to 'ucase.bup';
+
+--echo
+--echo # BACKUP both database
+--replace_column 1 #
+BACKUP DATABASE BACKUPCASETEST, backupcasetest to 'bothcases.bup';
+
+--echo #
+--echo # Print contents of the databases
+--echo #
+--echo #    Lower case database:
+--echo #
+
+SHOW TABLES IN backupcasetest;
+SELECT * FROM backupcasetest.lcase;
+
+--echo #
+--echo #    Upper case database:
+--echo #
+
+SHOW TABLES IN BACKUPCASETEST;
+SELECT * FROM BACKUPCASETEST.ucase;
+
+--echo #
+--echo # Drop the databases
+--echo #
+DROP DATABASE backupcasetest;
+DROP DATABASE BACKUPCASETEST;
+
+--echo #
+--echo # RESTORE lower case database and verify content
+--echo #
+--replace_column 1 #
+RESTORE FROM 'lcase.bup';
+
+--echo
+SHOW TABLES IN backupcasetest;
+SELECT * FROM backupcasetest.lcase;
+
+--echo #
+--echo # RESTORE upper case database and verify content
+--echo #
+--replace_column 1 #
+RESTORE FROM 'ucase.bup';
+
+--echo
+SHOW TABLES IN BACKUPCASETEST;
+SELECT * FROM BACKUPCASETEST.ucase;
+
+--echo #
+--echo # Drop the databases
+--echo #
+DROP DATABASE backupcasetest;
+DROP DATABASE BACKUPCASETEST;
+
+--echo #
+--echo # RESTORE backup image with both databases and verify content
+--echo #
+--replace_column 1 #
+RESTORE FROM 'bothcases.bup';
+
+--echo
+SHOW TABLES IN backupcasetest;
+SELECT * FROM backupcasetest.lcase;
+
+--echo
+SHOW TABLES IN BACKUPCASETEST;
+SELECT * FROM BACKUPCASETEST.ucase;
+
+--echo #
+--echo # CLEANUP
+--echo #
+DROP DATABASE backupcasetest;
+DROP DATABASE BACKUPCASETEST;
+
+let $MYSQLD_DATADIR = `select @@datadir`;
+--remove_file $MYSQLD_DATADIR/lcase.bup
+--remove_file $MYSQLD_DATADIR/ucase.bup
+--remove_file $MYSQLD_DATADIR/bothcases.bup
+

=== modified file 'mysql-test/suite/backup/t/backup_errors.test'
--- a/mysql-test/suite/backup/t/backup_errors.test	2009-02-20 00:04:53 +0000
+++ b/mysql-test/suite/backup/t/backup_errors.test	2009-03-04 10:02:58 +0000
@@ -117,14 +117,16 @@ SHOW WARNINGS;
 SELECT backup_state,operation,backup_file, command FROM mysql.backup_history;
 SELECT notes FROM mysql.backup_progress;
 
-#
-# Note: the following error is detected on parser level. Thus no 
-# backup_id is assigned and nothing is written to backup logs.
-#
 PURGE BACKUP LOGS;
+
+CREATE DATABASE foo;
+CREATE DATABASE bar;
+
+--echo # 
 --echo # repeated database
+--echo # 
 -- error ER_NONUNIQ_DB
-eval BACKUP DATABASE foo,test,bar,foo TO 'test.bak' $compression;
+eval BACKUP DATABASE foo, bar, foo TO 'test.bak' $compression;
 --replace_column 2 #
 SHOW WARNINGS;
 
@@ -132,6 +134,11 @@ SHOW WARNINGS;
 SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
 SELECT notes FROM mysql.backup_progress;
 
+DROP DATABASE foo;
+DROP DATABASE bar;
+
+PURGE BACKUP LOGS;
+
 # Test that BACKUP/RESTORE statements are disable inside stored routines,
 # triggers and events.
 

=== modified file 'sql/backup/backup_info.cc'
--- a/sql/backup/backup_info.cc	2009-02-23 21:32:11 +0000
+++ b/sql/backup/backup_info.cc	2009-03-04 10:02:58 +0000
@@ -642,10 +642,6 @@ int Backup_info::add_dbs(THD *thd, List<
   {
     backup::String db_name(*s);
 
-    // Ignore the database if it has already been inserted into the catalogue.    
-    if (has_db(db_name))
-      continue;
-    
     if (is_internal_db_name(&db_name))
     {
       m_log.report_error(ER_BACKUP_CANNOT_INCLUDE_DB, db_name.c_ptr());
@@ -653,7 +649,19 @@ int Backup_info::add_dbs(THD *thd, List<
     }
     
     obs::Obj *obj= get_database_stub(&db_name); // reports errors
+    
+    // Normalize DB name; if case insensitive server, obj->get_db_name
+    // returns name in lower case
+    db_name= obj->get_db_name()->ptr();
 
+    // Error if the same database is requested twice in the database list
+    if (has_db(db_name))
+    {
+      m_log.report_error(ER_NONUNIQ_DB, db_name.c_ptr());;
+      delete obj;
+      goto error;
+    }
+    
     if (obj && !check_db_existence(thd, &db_name))
     {    
       if (!unknown_dbs.is_empty()) // we just compose unknown_dbs list

=== modified file 'sql/si_objects.cc'
--- a/sql/si_objects.cc	2009-02-26 13:53:17 +0000
+++ b/sql/si_objects.cc	2009-03-04 10:02:58 +0000
@@ -886,7 +886,14 @@ public:
 
   inline Database_obj(LEX_STRING db_name)
     : Abstract_obj(db_name)
-  { }
+  {   
+    /* Make database name lower case if the server is case insensitive.
+     This is the case on Windows and if lower_case_table_names has
+     been set.
+    */
+    if (lower_case_table_names) 
+      my_casedn_str(files_charset_info, m_id.c_ptr());
+  }
 
 public:
   virtual inline const String *get_db_name() const { return get_name(); }

=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc	2009-02-05 12:49:39 +0000
+++ b/sql/sql_lex.cc	2009-03-04 10:02:58 +0000
@@ -3031,19 +3031,7 @@ int LEX::add_db_to_list(LEX_STRING *name
 {
   DBUG_ASSERT(name);
     
-  List_iterator<LEX_STRING> it(db_list);
-  LEX_STRING *copy;
-  
-  while ((copy= it++))
-   if (!my_strnncoll(system_charset_info, 
-                     (const uchar*) name->str, name->length , 
-                     (const uchar*) copy->str, copy->length ))
-   {    
-     my_error(ER_NONUNIQ_DB, MYF(0), name->str);
-     return ER_NONUNIQ_DB;
-   }
-
-  copy= (LEX_STRING*) sql_memdup(name, sizeof(LEX_STRING));
+  LEX_STRING *copy= (LEX_STRING*) sql_memdup(name, sizeof(LEX_STRING));
   if (copy == NULL)
     return ER_OUT_OF_RESOURCES;
     

Thread
bzr commit into mysql-6.0-backup branch (jorgen.loland:2784) Bug#39063Jorgen Loland4 Mar
  • Re: bzr commit into mysql-6.0-backup branch (jorgen.loland:2784)Bug#39063Chuck Bell4 Mar
    • Re: bzr commit into mysql-6.0-backup branch (jorgen.loland:2784)Bug#39063Rafal Somla5 Mar
    • Re: bzr commit into mysql-6.0-backup branch (jorgen.loland:2784)Bug#39063Jørgen Løland5 Mar
      • Re: bzr commit into mysql-6.0-backup branch (jorgen.loland:2784)Bug#39063Jørgen Løland5 Mar
      • Re: bzr commit into mysql-6.0-backup branch (jorgen.loland:2784)Bug#39063Rafal Somla5 Mar