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

New test cases. Names with umlauts don't compare well on Windows.
parent c8ad865f
......@@ -657,43 +657,45 @@ SELECT * FROM t1;
v b
abc 5
DROP TABLE t1;
DROP DATABASE IF EXISTS mysqltest;
CREATE DATABASE mysqltest;
use mysqltest;
DROP TABLE IF EXISTS `t1_ngel`, `t1_blten`;
CREATE TABLE `t1_ngel` (c1 INT);
ALTER TABLE `t1_ngel` RENAME `t1_blten`;
CREATE TABLE `t1_ngel` (c1 INT);
ALTER TABLE `t1_ngel` RENAME `t1_blten`;
ERROR 42S01: Table 't1_blЭten' already exists
DROP TABLE `t1_ngel`, `t1_blten`;
CREATE TEMPORARY TABLE `tt1_ngel` (c1 INT);
ALTER TABLE `tt1_ngel` RENAME `tt1_blten`;
CREATE TEMPORARY TABLE `tt1_ngel` (c1 INT);
ALTER TABLE `tt1_ngel` RENAME `tt1_blten`;
ERROR 42S01: Table 'tt1_blЭten' already exists
SHOW CREATE TABLE `tt1_blten`;
DROP TABLE IF EXISTS `t+1`, `t+2`;
CREATE TABLE `t+1` (c1 INT);
ALTER TABLE `t+1` RENAME `t+2`;
CREATE TABLE `t+1` (c1 INT);
ALTER TABLE `t+1` RENAME `t+2`;
ERROR 42S01: Table 't+2' already exists
DROP TABLE `t+1`, `t+2`;
CREATE TEMPORARY TABLE `tt+1` (c1 INT);
ALTER TABLE `tt+1` RENAME `tt+2`;
CREATE TEMPORARY TABLE `tt+1` (c1 INT);
ALTER TABLE `tt+1` RENAME `tt+2`;
ERROR 42S01: Table 'tt+2' already exists
SHOW CREATE TABLE `tt+1`;
Table Create Table
tt+1 CREATE TEMPORARY TABLE `tt+1` (
`c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE `tt+2`;
Table Create Table
tt1_blten CREATE TEMPORARY TABLE `tt1_blten` (
tt+2 CREATE TEMPORARY TABLE `tt+2` (
`c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE `tt1_ngel`, `tt1_blten`;
DROP TABLE `tt+1`, `tt+2`;
CREATE TABLE `#sql1` (c1 INT);
CREATE TABLE `@0023sql2` (c1 INT);
SHOW TABLES;
Tables_in_mysqltest
Tables_in_test
#sql1
@0023sql2
RENAME TABLE `#sql1` TO `@0023sql1`;
RENAME TABLE `@0023sql2` TO `#sql2`;
SHOW TABLES;
Tables_in_mysqltest
Tables_in_test
#sql2
@0023sql1
ALTER TABLE `@0023sql1` RENAME `#sql-1`;
ALTER TABLE `#sql2` RENAME `@0023sql-2`;
SHOW TABLES;
Tables_in_mysqltest
Tables_in_test
#sql-1
@0023sql-2
INSERT INTO `#sql-1` VALUES (1);
......@@ -702,18 +704,21 @@ DROP TABLE `#sql-1`, `@0023sql-2`;
CREATE TEMPORARY TABLE `#sql1` (c1 INT);
CREATE TEMPORARY TABLE `@0023sql2` (c1 INT);
SHOW TABLES;
Tables_in_mysqltest
Tables_in_test
ALTER TABLE `#sql1` RENAME `@0023sql1`;
ALTER TABLE `@0023sql2` RENAME `#sql2`;
SHOW TABLES;
Tables_in_mysqltest
Tables_in_test
INSERT INTO `#sql2` VALUES (1);
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`;
Table Create Table
@0023sql1 CREATE TEMPORARY TABLE `@0023sql1` (
`c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE `#sql2`, `@0023sql1`;
use test;
DROP DATABASE mysqltest;
......@@ -101,23 +101,23 @@ test.t5 backup status OK
Warnings:
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 IF EXISTS `t-blten`;
CREATE TABLE `t-blten` (c1 INT);
INSERT INTO `t-blten` VALUES (1), (2), (3);
BACKUP TABLE `t-blten` TO '../tmp';
DROP TABLE IF EXISTS `t+1`;
CREATE TABLE `t+1` (c1 INT);
INSERT INTO `t+1` VALUES (1), (2), (3);
BACKUP TABLE `t+1` TO '../tmp';
Table Op Msg_type Msg_text
test.t-blten backup status OK
test.t+1 backup status OK
Warnings:
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`;
RESTORE TABLE `t-blten` FROM '../tmp';
DROP TABLE `t+1`;
RESTORE TABLE `t+1` FROM '../tmp';
Table Op Msg_type Msg_text
test.t-blten restore status OK
test.t+1 restore status OK
Warnings:
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
1
2
3
DROP TABLE `t-blten`;
DROP TABLE `t+1`;
......@@ -488,32 +488,26 @@ DROP TABLE t1;
#
# 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
DROP DATABASE IF EXISTS mysqltest;
DROP TABLE IF EXISTS `t+1`, `t+2`;
--enable_warnings
CREATE DATABASE mysqltest;
use mysqltest;
#
# 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);
CREATE TABLE `t+1` (c1 INT);
ALTER TABLE `t+1` RENAME `t+2`;
CREATE TABLE `t+1` (c1 INT);
--error ER_TABLE_EXISTS_ERROR
ALTER TABLE `t1_ngel` RENAME `t1_blten`;
DROP TABLE `t1_ngel`, `t1_blten`;
ALTER TABLE `t+1` RENAME `t+2`;
DROP TABLE `t+1`, `t+2`;
#
# Same for temporary tables though these names do not become file names.
CREATE TEMPORARY TABLE `tt1_ngel` (c1 INT);
ALTER TABLE `tt1_ngel` RENAME `tt1_blten`;
CREATE TEMPORARY TABLE `tt1_ngel` (c1 INT);
CREATE TEMPORARY TABLE `tt+1` (c1 INT);
ALTER TABLE `tt+1` RENAME `tt+2`;
CREATE TEMPORARY TABLE `tt+1` (c1 INT);
--error ER_TABLE_EXISTS_ERROR
ALTER TABLE `tt1_ngel` RENAME `tt1_blten`;
SHOW CREATE TABLE `tt1_blten`;
DROP TABLE `tt1_ngel`, `tt1_blten`;
ALTER TABLE `tt+1` RENAME `tt+2`;
SHOW CREATE TABLE `tt+1`;
SHOW CREATE TABLE `tt+2`;
DROP TABLE `tt+1`, `tt+2`;
#
# Check if special characters as in tmp_file_prefix work.
CREATE TABLE `#sql1` (c1 INT);
......@@ -538,10 +532,7 @@ ALTER TABLE `@0023sql2` RENAME `#sql2`;
SHOW TABLES;
INSERT INTO `#sql2` VALUES (1);
INSERT INTO `@0023sql1` VALUES (2);
SHOW CREATE TABLE `#sql2`;
SHOW CREATE TABLE `@0023sql1`;
DROP TABLE `#sql2`, `@0023sql1`;
#
# Cleanup
use test;
DROP DATABASE mysqltest;
......@@ -65,15 +65,15 @@ drop table t5;
#
# Backup did not encode table names.
--disable_warnings
DROP TABLE IF EXISTS `t-blten`;
DROP TABLE IF EXISTS `t+1`;
--enable_warnings
CREATE TABLE `t-blten` (c1 INT);
INSERT INTO `t-blten` VALUES (1), (2), (3);
BACKUP TABLE `t-blten` TO '../tmp';
DROP TABLE `t-blten`;
CREATE TABLE `t+1` (c1 INT);
INSERT INTO `t+1` VALUES (1), (2), (3);
BACKUP TABLE `t+1` TO '../tmp';
DROP TABLE `t+1`;
#
# Same for restore.
RESTORE TABLE `t-blten` FROM '../tmp';
SELECT * FROM `t-blten`;
DROP TABLE `t-blten`;
RESTORE TABLE `t+1` FROM '../tmp';
SELECT * FROM `t+1`;
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