From 0d71d913d3808cf785d55686bdf22ff0352f02d3 Mon Sep 17 00:00:00 2001 From: Aditya A Date: Tue, 26 Feb 2013 17:57:05 +0530 Subject: [PATCH] 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 ] --- sql/sql_partition_admin.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);