Commit b6fb4dba authored by Jon Olav Hauglid's avatar Jon Olav Hauglid

Backport of revno: 2617.68.45

Bug #47635 assert in start_waiting_global_read_lock during CREATE VIEW

The problem was that CREATE VIEW would trigger an assert if
a temporary table with the same name already existed.

This bug was fixed by the patch for Bug#47335. CREATE/ALTER VIEW
will now ignore temporary tables. See Bug#47335 for more information.

Test case added to view.test.
parent 3173cf33
......@@ -3976,3 +3976,18 @@ SELECT * FROM v1;
f1
2
DROP VIEW v1;
#
# Bug #47635 assert in start_waiting_global_read_lock
# during CREATE VIEW
#
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS t2;
CREATE TABLE t1 (f1 integer);
CREATE TEMPORARY TABLE IF NOT EXISTS t1 (f1 integer);
CREATE TEMPORARY TABLE t2 (f1 integer);
DROP TABLE t1;
FLUSH TABLES WITH READ LOCK;
CREATE VIEW t2 AS SELECT * FROM t1;
ERROR HY000: Can't execute the query because you have a conflicting read lock
UNLOCK TABLES;
DROP TABLE t1, t2;
--disable_warnings
drop table if exists t1,t2,t3,t4,t9,`t1a``b`,v1,v2,v3,v4,v5,v6;
drop view if exists t1,t2,`t1a``b`,v1,v2,v3,v4,v5,v6;
......@@ -3927,3 +3928,25 @@ ALTER VIEW v1 AS SELECT 2 AS f1;
DROP TABLE v1;
SELECT * FROM v1;
DROP VIEW v1;
--echo #
--echo # Bug #47635 assert in start_waiting_global_read_lock
--echo # during CREATE VIEW
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS t2;
--enable_warnings
CREATE TABLE t1 (f1 integer);
CREATE TEMPORARY TABLE IF NOT EXISTS t1 (f1 integer);
CREATE TEMPORARY TABLE t2 (f1 integer);
DROP TABLE t1;
FLUSH TABLES WITH READ LOCK;
--error ER_CANT_UPDATE_WITH_READLOCK
CREATE VIEW t2 AS SELECT * FROM t1;
UNLOCK TABLES;
DROP TABLE t1, 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