mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
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.
This commit is contained in:
parent
de493d92b2
commit
b47e4fbf83
2 changed files with 82 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue