MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Magne Mahre Date:May 5 2010 9:29pm
Subject:bzr commit into mysql-trunk-runtime branch (magne.mahre:3013) Bug#49193
View as plain text  
#At file:///data/z/mysql-trunk-runtime/ based on revid:magne.mahre@stripped

 3013 Magne Mahre	2010-05-05
      Bug#49193 CREATE TABLE reacts differently depending on whether 
                data is selected or not
      
      Temporary and permanent tables should live in different 
      namespaces.  In this case, resolving a permanent table
      name gave the temporary table, resulting in a name
      collision.

    modified:
      mysql-test/r/create.result
      mysql-test/t/create.test
=== modified file 'mysql-test/r/create.result'
--- a/mysql-test/r/create.result	2010-05-05 10:17:07 +0000
+++ b/mysql-test/r/create.result	2010-05-05 21:28:58 +0000
@@ -1992,3 +1992,44 @@ CREATE TABLE t4 AS SELECT 1;
 DROP TEMPORARY TABLE t1, t2, t3, t4;
 DROP TABLE t1, t3, t4;
 DROP VIEW t2;
+#
+# Bug #49193 CREATE TABLE reacts differently depending 
+#            on whether data is selected or not
+#
+CREATE TEMPORARY TABLE t2 (ID INT);
+INSERT INTO t2 VALUES (1),(2),(3);
+CREATE TEMPORARY TABLE t1 (ID INT);
+CREATE TABLE IF NOT EXISTS t1 (ID INT);
+INSERT INTO t1 SELECT * FROM t2;
+SELECT * FROM t1;
+ID
+1
+2
+3
+DROP TEMPORARY TABLE t1;
+SELECT * FROM t1;
+ID
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1 (ID INT);
+CREATE TABLE IF NOT EXISTS t1 SELECT * FROM t2;
+SELECT * FROM t1;
+ID
+DROP TEMPORARY TABLE t1;
+SELECT * FROM t1;
+ID
+1
+2
+3
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1 (ID INT);
+CREATE TABLE t1 SELECT * FROM t2;
+SELECT * FROM t1;
+ID
+DROP TEMPORARY TABLE t1;
+SELECT * FROM t1;
+ID
+1
+2
+3
+DROP TABLE t1;
+DROP TEMPORARY TABLE t2;

=== modified file 'mysql-test/t/create.test'
--- a/mysql-test/t/create.test	2010-05-05 10:17:07 +0000
+++ b/mysql-test/t/create.test	2010-05-05 21:28:58 +0000
@@ -1690,3 +1690,44 @@ DROP TEMPORARY TABLE t1, t2, t3, t4;
 DROP TABLE t1, t3, t4;
 DROP VIEW t2;
 
+--echo #
+--echo # Bug #49193 CREATE TABLE reacts differently depending 
+--echo #            on whether data is selected or not
+--echo #
+
+CREATE TEMPORARY TABLE t2 (ID INT);
+INSERT INTO t2 VALUES (1),(2),(3);
+
+# Case 1 -- did not fail
+CREATE TEMPORARY TABLE t1 (ID INT);
+CREATE TABLE IF NOT EXISTS t1 (ID INT);
+INSERT INTO t1 SELECT * FROM t2;
+SELECT * FROM t1;
+DROP TEMPORARY TABLE t1;
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+# Case 2 -- The DROP TABLE t1 failed with 
+#  Table 'test.t1' doesn't exist in the SELECT *
+# as the (permanent) table was not created
+CREATE TEMPORARY TABLE t1 (ID INT);
+CREATE TABLE IF NOT EXISTS t1 SELECT * FROM t2;
+SELECT * FROM t1;
+DROP TEMPORARY TABLE t1;
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+# Case 3 -- The CREATE TABLE failed with
+#  Table 't1' already exists
+CREATE TEMPORARY TABLE t1 (ID INT);
+CREATE TABLE t1 SELECT * FROM t2;
+SELECT * FROM t1;
+DROP TEMPORARY TABLE t1;
+SELECT * FROM t1;
+ 
+DROP TABLE t1;
+ 
+DROP TEMPORARY TABLE t2;
+


Attachment: [text/bzr-bundle] bzr/magne.mahre@sun.com-20100505212858-ksrf3k35e6ovfg3t.bundle
Thread
bzr commit into mysql-trunk-runtime branch (magne.mahre:3013) Bug#49193Magne Mahre5 May