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
commiteebffb422b515f6b8a32401679fb202f531a58e3 (patch)
tree6d3c909b8163402199ee3247c59f546ffb18af59 /sql/sql_insert.cc
parent81053daf9731145a84827ca0ce58b0097518ccf0 (diff)
downloadmariadb-git-eebffb422b515f6b8a32401679fb202f531a58e3.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.
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)