summaryrefslogtreecommitdiff
path: root/sql/sql_partition_admin.cc
diff options
context:
space:
mode:
authorAditya A <aditya.a@oracle.com>2013-02-26 17:57:05 +0530
committerAditya A <aditya.a@oracle.com>2013-02-26 17:57:05 +0530
commit460852b318e9f6862cfa9935506e1f4217b10090 (patch)
treee79c595be9371ae022c1eb92a7517f6f08f4a6c8 /sql/sql_partition_admin.cc
parent8f732210355a2558e4303e945f30bf2064d4a320 (diff)
downloadmariadb-git-460852b318e9f6862cfa9935506e1f4217b10090.tar.gz
Bug#14653504 CRASH WHEN TRUNCATING PARTITIONS FROM A VIEW!
ANALYSIS -------- When we open the view using open_new_frm() ,it doesnt set the table-list->table variable and any access to table_list->table will cause a crash. FIX --- Added a check during execution of the alter partition to return error if table is view. [http://rb.no.oracle.com/rb/r/2001/ Approved by Mattias J ]
Diffstat (limited to 'sql/sql_partition_admin.cc')
-rw-r--r--sql/sql_partition_admin.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc
index 4edd47de855..b9bf3dbc217 100644
--- a/sql/sql_partition_admin.cc
+++ b/sql/sql_partition_admin.cc
@@ -141,7 +141,9 @@ bool Alter_table_truncate_partition_statement::execute(THD *thd)
TODO: Add support for TRUNCATE PARTITION for NDB and other
engines supporting native partitioning.
*/
- if (first_table->table->s->db_type() != partition_hton)
+
+ if (!first_table->table || first_table->view ||
+ first_table->table->s->db_type() != partition_hton)
{
my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0));
DBUG_RETURN(TRUE);