diff options
author | Satya B <satya.bn@sun.com> | 2009-09-04 12:21:54 +0530 |
---|---|---|
committer | Satya B <satya.bn@sun.com> | 2009-09-04 12:21:54 +0530 |
commit | 6e27ef435e3863382295f1a1d41424c9b8d4c197 (patch) | |
tree | 6d3c909b8163402199ee3247c59f546ffb18af59 /mysql-test/t/create.test | |
parent | 482fdb5fc703e502a0cbb17ed035487e2b034fb7 (diff) | |
download | mariadb-git-6e27ef435e3863382295f1a1d41424c9b8d4c197.tar.gz |
Fix for BUG#46384 - mysqld segfault when trying to create table with same
name as existing view
When trying to create a table with the same name as existing view with
join, mysql server crashes.
The problem is when create table is issued with the same name as view, while
verifying with the existing tables, we assume that base table object is
created always.
In this case, since it is a view over multiple tables, we don't have the
mysql derived table object.
Fixed the logic which checks if there is an existing table to not to assume
that table object is created when the base table is view over multiple
tables.
mysql-test/r/create.result:
BUG#46384 - mysqld segfault when trying to create table with same
name as existing view
Testcase for the bug
mysql-test/t/create.test:
BUG#46384 - mysqld segfault when trying to create table with same
name as existing view
Testcase for the bug
sql/sql_insert.cc:
BUG#46384 - mysqld segfault when trying to create table with same
name as existing view
Fixed create_table_from_items() method to properly check, if the base table
is a view over multiple tables.
Diffstat (limited to 'mysql-test/t/create.test')
-rw-r--r-- | mysql-test/t/create.test | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index a837653d618..2ec416cfc87 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -1194,5 +1194,22 @@ CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY) DROP TABLE t1, t2; +--echo # +--echo # BUG#46384 - mysqld segfault when trying to create table with same +--echo # name as existing view +--echo # + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); + +INSERT INTO t1 VALUES (1),(2),(3); +INSERT INTO t2 VALUES (1),(2),(3); + +CREATE VIEW v1 AS SELECT t1.a FROM t1, t2; +--error ER_TABLE_EXISTS_ERROR +CREATE TABLE v1 AS SELECT * FROM t1; + +DROP VIEW v1; +DROP TABLE t1,t2; --echo End of 5.0 tests |