#At file:///D:/source/bzr/mysql-6.0-45914/ based on
revid:jorgen.loland@stripped
2857 Chuck Bell 2009-08-10
BUG#45914 : Restore errors if there is a privilege on a quoted database name
The bug can no longer be repeated. This patch adds a regression
test case to ensure the problem doesn't return.
@ mysql-test/suite/backup/r/backup_objects.result
Result file with new test case.
@ mysql-test/suite/backup/t/backup_objects.test
Added test that case executes backup and restore of a database using
quoted name and privileges assigned to a user.
modified:
mysql-test/suite/backup/r/backup_objects.result
mysql-test/suite/backup/t/backup_objects.test
=== modified file 'mysql-test/suite/backup/r/backup_objects.result'
--- a/mysql-test/suite/backup/r/backup_objects.result 2009-03-04 10:35:42 +0000
+++ b/mysql-test/suite/backup/r/backup_objects.result 2009-08-10 21:42:06 +0000
@@ -7,8 +7,12 @@ Change client connection charset
SET character_set_client = 'latin2';
DROP DATABASE IF EXISTS db1;
DROP DATABASE IF EXISTS db2;
+DROP DATABASE IF EXISTS `db3`;
+DROP DATABASE IF EXISTS `db 4`;
CREATE DATABASE db1;
CREATE DATABASE db2;
+CREATE DATABASE `db3`;
+CREATE DATABASE `db 4`;
CREATE PROCEDURE db1.p11()
BEGIN
UPDATE db2.t21 SET b = (SELECT b FROM db1.v11 WHERE a = 1);
@@ -273,6 +277,33 @@ a b
3 1
2 2
1 3
+#
+# Test case - Test backup of quoted database names.
+# BUG#45914 regression test (can't repeat).
+#
+#
+# Create a user and assign privileges to databases with quoted names.
+#
+CREATE USER 'joe'@'user';
+GRANT ALL ON `db3`.* TO 'joe'@'user';
+GRANT ALL ON `db 4`.* TO 'joe'@'user';
+#
+# Run backup.
+#
+BACKUP DATABASE `db3`, `db 4` TO 'test_quote.bak';
+backup_id
+#
+DROP DATABASE `db3`;
+DROP DATABASE `db 4`;
+#
+# Attempt restore of databases (should not fail).
+#
+RESTORE FROM 'test_quote.bak';
+backup_id
+#
+DROP USER 'joe'@'user';
Cleanup
DROP DATABASE db1;
DROP DATABASE db2;
+DROP DATABASE `db3`;
+DROP DATABASE `db 4`;
=== modified file 'mysql-test/suite/backup/t/backup_objects.test'
--- a/mysql-test/suite/backup/t/backup_objects.test 2009-02-24 20:57:21 +0000
+++ b/mysql-test/suite/backup/t/backup_objects.test 2009-08-10 21:42:06 +0000
@@ -54,10 +54,14 @@ SET character_set_client = 'latin2';
--disable_warnings
DROP DATABASE IF EXISTS db1;
DROP DATABASE IF EXISTS db2;
+DROP DATABASE IF EXISTS `db3`;
+DROP DATABASE IF EXISTS `db 4`;
--enable_warnings
CREATE DATABASE db1;
CREATE DATABASE db2;
+CREATE DATABASE `db3`;
+CREATE DATABASE `db 4`;
# Create functions and procedures. Note that they operate on tables and
# views defined below and also call each other.
@@ -214,7 +218,39 @@ SELECT * FROM db1.v12;
SELECT * FROM db2.v21;
SELECT * FROM db2.v22;
+--echo #
+--echo # Test case - Test backup of quoted database names.
+--echo # BUG#45914 regression test (can't repeat).
+--echo #
+
+--echo #
+--echo # Create a user and assign privileges to databases with quoted names.
+--echo #
+CREATE USER 'joe'@'user';
+GRANT ALL ON `db3`.* TO 'joe'@'user';
+GRANT ALL ON `db 4`.* TO 'joe'@'user';
+
+--echo #
+--echo # Run backup.
+--echo #
+--replace_column 1 #
+BACKUP DATABASE `db3`, `db 4` TO 'test_quote.bak';
+
+DROP DATABASE `db3`;
+DROP DATABASE `db 4`;
+
+--echo #
+--echo # Attempt restore of databases (should not fail).
+--echo #
+--replace_column 1 #
+RESTORE FROM 'test_quote.bak';
+
+--remove_file $MYSQLD_BACKUPDIR/test_quote.bak
+DROP USER 'joe'@'user';
+
--echo Cleanup
DROP DATABASE db1;
DROP DATABASE db2;
+DROP DATABASE `db3`;
+DROP DATABASE `db 4`;
--remove_file $MYSQLD_BACKUPDIR/bup_objects.bak
Attachment: [text/bzr-bundle] bzr/charles.bell@sun.com-20090810214206-z9swiqddjfxc9nby.bundle