summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorSatya B <satya.bn@sun.com>2009-09-04 12:21:54 +0530
committerSatya B <satya.bn@sun.com>2009-09-04 12:21:54 +0530
commita3edfac75ae41b2f223fdbe9d08ad967be9f01a1 (patch)
tree6d3c909b8163402199ee3247c59f546ffb18af59 /sql/sql_insert.cc
parent287ad86fb2bdd75aceae4be3f007d9bd1bf2ab51 (diff)
downloadmariadb-git-a3edfac75ae41b2f223fdbe9d08ad967be9f01a1.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 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index d2a0f47f1a9..b0958201795 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -3217,7 +3217,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
DBUG_EXECUTE_IF("sleep_create_select_before_check_if_exists", my_sleep(6000000););
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
- create_table->table->db_stat)
+ (create_table->table && create_table->table->db_stat))
{
/* Table already exists and was open at open_and_lock_tables() stage. */
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)