Commit ce4b9c82 authored by unknown's avatar unknown

Bug#18775 - Temporary table from alter table visible to other threads

New test cases. Names with umlauts don't compare well on Windows.


mysql-test/r/alter_table.result:
  Bug#18775 - Temporary table from alter table visible to other threads
  New test results
mysql-test/r/backup.result:
  Bug#18775 - Temporary table from alter table visible to other threads
  New test results
mysql-test/t/alter_table.test:
  Bug#18775 - Temporary table from alter table visible to other threads
  New test case. Names with umlauts don't compare well on Windows.
mysql-test/t/backup.test:
  Bug#18775 - Temporary table from alter table visible to other threads
  New test case. Names with umlauts don't compare well on Windows.
parent efcf996f
...@@ -657,43 +657,45 @@ SELECT * FROM t1; ...@@ -657,43 +657,45 @@ SELECT * FROM t1;
v b v b
abc 5 abc 5
DROP TABLE t1; DROP TABLE t1;
DROP DATABASE IF EXISTS mysqltest; DROP TABLE IF EXISTS `t+1`, `t+2`;
CREATE DATABASE mysqltest; CREATE TABLE `t+1` (c1 INT);
use mysqltest; ALTER TABLE `t+1` RENAME `t+2`;
DROP TABLE IF EXISTS `t1_ngel`, `t1_blten`; CREATE TABLE `t+1` (c1 INT);
CREATE TABLE `t1_ngel` (c1 INT); ALTER TABLE `t+1` RENAME `t+2`;
ALTER TABLE `t1_ngel` RENAME `t1_blten`; ERROR 42S01: Table 't+2' already exists
CREATE TABLE `t1_ngel` (c1 INT); DROP TABLE `t+1`, `t+2`;
ALTER TABLE `t1_ngel` RENAME `t1_blten`; CREATE TEMPORARY TABLE `tt+1` (c1 INT);
ERROR 42S01: Table 't1_blЭten' already exists ALTER TABLE `tt+1` RENAME `tt+2`;
DROP TABLE `t1_ngel`, `t1_blten`; CREATE TEMPORARY TABLE `tt+1` (c1 INT);
CREATE TEMPORARY TABLE `tt1_ngel` (c1 INT); ALTER TABLE `tt+1` RENAME `tt+2`;
ALTER TABLE `tt1_ngel` RENAME `tt1_blten`; ERROR 42S01: Table 'tt+2' already exists
CREATE TEMPORARY TABLE `tt1_ngel` (c1 INT); SHOW CREATE TABLE `tt+1`;
ALTER TABLE `tt1_ngel` RENAME `tt1_blten`; Table Create Table
ERROR 42S01: Table 'tt1_blЭten' already exists tt+1 CREATE TEMPORARY TABLE `tt+1` (
SHOW CREATE TABLE `tt1_blten`; `c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE `tt+2`;
Table Create Table Table Create Table
tt1_blten CREATE TEMPORARY TABLE `tt1_blten` ( tt+2 CREATE TEMPORARY TABLE `tt+2` (
`c1` int(11) DEFAULT NULL `c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE `tt1_ngel`, `tt1_blten`; DROP TABLE `tt+1`, `tt+2`;
CREATE TABLE `#sql1` (c1 INT); CREATE TABLE `#sql1` (c1 INT);
CREATE TABLE `@0023sql2` (c1 INT); CREATE TABLE `@0023sql2` (c1 INT);
SHOW TABLES; SHOW TABLES;
Tables_in_mysqltest Tables_in_test
#sql1 #sql1
@0023sql2 @0023sql2
RENAME TABLE `#sql1` TO `@0023sql1`; RENAME TABLE `#sql1` TO `@0023sql1`;
RENAME TABLE `@0023sql2` TO `#sql2`; RENAME TABLE `@0023sql2` TO `#sql2`;
SHOW TABLES; SHOW TABLES;
Tables_in_mysqltest Tables_in_test
#sql2 #sql2
@0023sql1 @0023sql1
ALTER TABLE `@0023sql1` RENAME `#sql-1`; ALTER TABLE `@0023sql1` RENAME `#sql-1`;
ALTER TABLE `#sql2` RENAME `@0023sql-2`; ALTER TABLE `#sql2` RENAME `@0023sql-2`;
SHOW TABLES; SHOW TABLES;
Tables_in_mysqltest Tables_in_test
#sql-1 #sql-1
@0023sql-2 @0023sql-2
INSERT INTO `#sql-1` VALUES (1); INSERT INTO `#sql-1` VALUES (1);
...@@ -702,18 +704,21 @@ DROP TABLE `#sql-1`, `@0023sql-2`; ...@@ -702,18 +704,21 @@ DROP TABLE `#sql-1`, `@0023sql-2`;
CREATE TEMPORARY TABLE `#sql1` (c1 INT); CREATE TEMPORARY TABLE `#sql1` (c1 INT);
CREATE TEMPORARY TABLE `@0023sql2` (c1 INT); CREATE TEMPORARY TABLE `@0023sql2` (c1 INT);
SHOW TABLES; SHOW TABLES;
Tables_in_mysqltest Tables_in_test
ALTER TABLE `#sql1` RENAME `@0023sql1`; ALTER TABLE `#sql1` RENAME `@0023sql1`;
ALTER TABLE `@0023sql2` RENAME `#sql2`; ALTER TABLE `@0023sql2` RENAME `#sql2`;
SHOW TABLES; SHOW TABLES;
Tables_in_mysqltest Tables_in_test
INSERT INTO `#sql2` VALUES (1); INSERT INTO `#sql2` VALUES (1);
INSERT INTO `@0023sql1` VALUES (2); INSERT INTO `@0023sql1` VALUES (2);
SHOW CREATE TABLE `#sql2`;
Table Create Table
#sql2 CREATE TEMPORARY TABLE `#sql2` (
`c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE `@0023sql1`; SHOW CREATE TABLE `@0023sql1`;
Table Create Table Table Create Table
@0023sql1 CREATE TEMPORARY TABLE `@0023sql1` ( @0023sql1 CREATE TEMPORARY TABLE `@0023sql1` (
`c1` int(11) DEFAULT NULL `c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE `#sql2`, `@0023sql1`; DROP TABLE `#sql2`, `@0023sql1`;
use test;
DROP DATABASE mysqltest;
...@@ -101,23 +101,23 @@ test.t5 backup status OK ...@@ -101,23 +101,23 @@ test.t5 backup status OK
Warnings: Warnings:
Warning 1541 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead. Warning 1541 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
drop table t5; drop table t5;
DROP TABLE IF EXISTS `t-blten`; DROP TABLE IF EXISTS `t+1`;
CREATE TABLE `t-blten` (c1 INT); CREATE TABLE `t+1` (c1 INT);
INSERT INTO `t-blten` VALUES (1), (2), (3); INSERT INTO `t+1` VALUES (1), (2), (3);
BACKUP TABLE `t-blten` TO '../tmp'; BACKUP TABLE `t+1` TO '../tmp';
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t-blten backup status OK test.t+1 backup status OK
Warnings: Warnings:
Warning 1541 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead. Warning 1541 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
DROP TABLE `t-blten`; DROP TABLE `t+1`;
RESTORE TABLE `t-blten` FROM '../tmp'; RESTORE TABLE `t+1` FROM '../tmp';
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t-blten restore status OK test.t+1 restore status OK
Warnings: Warnings:
Warning 1541 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead. Warning 1541 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
SELECT * FROM `t-blten`; SELECT * FROM `t+1`;
c1 c1
1 1
2 2
3 3
DROP TABLE `t-blten`; DROP TABLE `t+1`;
...@@ -488,32 +488,26 @@ DROP TABLE t1; ...@@ -488,32 +488,26 @@ DROP TABLE t1;
# #
# Bug#18775 - Temporary table from alter table visible to other threads # Bug#18775 - Temporary table from alter table visible to other threads
# #
# Use a special database to avoid name clashes with user tables. # Check if special characters work and duplicates are detected.
--disable_warnings --disable_warnings
DROP DATABASE IF EXISTS mysqltest; DROP TABLE IF EXISTS `t+1`, `t+2`;
--enable_warnings --enable_warnings
CREATE DATABASE mysqltest; CREATE TABLE `t+1` (c1 INT);
use mysqltest; ALTER TABLE `t+1` RENAME `t+2`;
# CREATE TABLE `t+1` (c1 INT);
# Check if non-ASCII alphabetic characters work and duplicates are detected.
--disable_warnings
DROP TABLE IF EXISTS `t1_ngel`, `t1_blten`;
--enable_warnings
CREATE TABLE `t1_ngel` (c1 INT);
ALTER TABLE `t1_ngel` RENAME `t1_blten`;
CREATE TABLE `t1_ngel` (c1 INT);
--error ER_TABLE_EXISTS_ERROR --error ER_TABLE_EXISTS_ERROR
ALTER TABLE `t1_ngel` RENAME `t1_blten`; ALTER TABLE `t+1` RENAME `t+2`;
DROP TABLE `t1_ngel`, `t1_blten`; DROP TABLE `t+1`, `t+2`;
# #
# Same for temporary tables though these names do not become file names. # Same for temporary tables though these names do not become file names.
CREATE TEMPORARY TABLE `tt1_ngel` (c1 INT); CREATE TEMPORARY TABLE `tt+1` (c1 INT);
ALTER TABLE `tt1_ngel` RENAME `tt1_blten`; ALTER TABLE `tt+1` RENAME `tt+2`;
CREATE TEMPORARY TABLE `tt1_ngel` (c1 INT); CREATE TEMPORARY TABLE `tt+1` (c1 INT);
--error ER_TABLE_EXISTS_ERROR --error ER_TABLE_EXISTS_ERROR
ALTER TABLE `tt1_ngel` RENAME `tt1_blten`; ALTER TABLE `tt+1` RENAME `tt+2`;
SHOW CREATE TABLE `tt1_blten`; SHOW CREATE TABLE `tt+1`;
DROP TABLE `tt1_ngel`, `tt1_blten`; SHOW CREATE TABLE `tt+2`;
DROP TABLE `tt+1`, `tt+2`;
# #
# Check if special characters as in tmp_file_prefix work. # Check if special characters as in tmp_file_prefix work.
CREATE TABLE `#sql1` (c1 INT); CREATE TABLE `#sql1` (c1 INT);
...@@ -538,10 +532,7 @@ ALTER TABLE `@0023sql2` RENAME `#sql2`; ...@@ -538,10 +532,7 @@ ALTER TABLE `@0023sql2` RENAME `#sql2`;
SHOW TABLES; SHOW TABLES;
INSERT INTO `#sql2` VALUES (1); INSERT INTO `#sql2` VALUES (1);
INSERT INTO `@0023sql1` VALUES (2); INSERT INTO `@0023sql1` VALUES (2);
SHOW CREATE TABLE `#sql2`;
SHOW CREATE TABLE `@0023sql1`; SHOW CREATE TABLE `@0023sql1`;
DROP TABLE `#sql2`, `@0023sql1`; DROP TABLE `#sql2`, `@0023sql1`;
#
# Cleanup
use test;
DROP DATABASE mysqltest;
...@@ -65,15 +65,15 @@ drop table t5; ...@@ -65,15 +65,15 @@ drop table t5;
# #
# Backup did not encode table names. # Backup did not encode table names.
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS `t-blten`; DROP TABLE IF EXISTS `t+1`;
--enable_warnings --enable_warnings
CREATE TABLE `t-blten` (c1 INT); CREATE TABLE `t+1` (c1 INT);
INSERT INTO `t-blten` VALUES (1), (2), (3); INSERT INTO `t+1` VALUES (1), (2), (3);
BACKUP TABLE `t-blten` TO '../tmp'; BACKUP TABLE `t+1` TO '../tmp';
DROP TABLE `t-blten`; DROP TABLE `t+1`;
# #
# Same for restore. # Same for restore.
RESTORE TABLE `t-blten` FROM '../tmp'; RESTORE TABLE `t+1` FROM '../tmp';
SELECT * FROM `t-blten`; SELECT * FROM `t+1`;
DROP TABLE `t-blten`; DROP TABLE `t+1`;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment