Commit de493d92 authored by Magne Mahre's avatar Magne Mahre

Bug#48800 CREATE TABLE t...SELECT fails if t is a temporary

          table

If a temporary table A exists, and a (permanent) table 
with the same name is attempted created with 
"CREATE TABLE ... AS SELECT", the create would fail with 
an error.
   1050: Table 'A' already exists

The error occured in MySQL 5.1 releases, but is not
present in MySQL 5.5.   This patch adds a regression
test to ensure that the problem does not reoccur.
parent a03ce039
...@@ -1977,3 +1977,18 @@ CREATE TABLE t1 LIKE t2; ...@@ -1977,3 +1977,18 @@ CREATE TABLE t1 LIKE t2;
ERROR 42S01: Table 't1' already exists ERROR 42S01: Table 't1' already exists
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #48800 CREATE TABLE t...SELECT fails if t is a
# temporary table
#
CREATE TEMPORARY TABLE t1 (a INT);
CREATE TABLE t1 (a INT);
CREATE TEMPORARY TABLE t2 (a INT);
CREATE VIEW t2 AS SELECT 1;
CREATE TABLE t3 (a INT);
CREATE TEMPORARY TABLE t3 SELECT 1;
CREATE TEMPORARY TABLE t4 (a INT);
CREATE TABLE t4 AS SELECT 1;
DROP TEMPORARY TABLE t1, t2, t3, t4;
DROP TABLE t1, t3, t4;
DROP VIEW t2;
...@@ -1668,3 +1668,25 @@ CREATE TABLE t1 LIKE t2; ...@@ -1668,3 +1668,25 @@ CREATE TABLE t1 LIKE t2;
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug #48800 CREATE TABLE t...SELECT fails if t is a
--echo # temporary table
--echo #
CREATE TEMPORARY TABLE t1 (a INT);
CREATE TABLE t1 (a INT);
CREATE TEMPORARY TABLE t2 (a INT);
CREATE VIEW t2 AS SELECT 1;
CREATE TABLE t3 (a INT);
CREATE TEMPORARY TABLE t3 SELECT 1;
CREATE TEMPORARY TABLE t4 (a INT);
CREATE TABLE t4 AS SELECT 1;
DROP TEMPORARY TABLE t1, t2, t3, t4;
DROP TABLE t1, t3, t4;
DROP VIEW t2;
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