Commit 48469933 authored by unknown's avatar unknown

Bug #17497: Partitions: crash if add partition on temporary table

  Temporary tables are no longer allowed to be partitioned.


mysql-test/r/partition.result:
  Add result
mysql-test/t/partition.test:
  Add new regression test
sql/share/errmsg.txt:
  Add new error message
sql/sql_table.cc:
  Don't allow creating temporary table with partitions
parent 56df7223
...@@ -422,4 +422,6 @@ partition_name partition_description table_rows ...@@ -422,4 +422,6 @@ partition_name partition_description table_rows
x123 11,12 1 x123 11,12 1
x234 NULL,1 1 x234 NULL,1 1
drop table t1; drop table t1;
create temporary table t1 (a int) partition by hash(a);
ERROR HY000: Cannot create temporary table with partitions
End of 5.1 tests End of 5.1 tests
...@@ -540,4 +540,10 @@ select partition_name, partition_description, table_rows ...@@ -540,4 +540,10 @@ select partition_name, partition_description, table_rows
from information_schema.partitions where table_schema ='test'; from information_schema.partitions where table_schema ='test';
drop table t1; drop table t1;
#
# Bug #17497: Partitions: crash if add partition on temporary table
#
--error ER_PARTITION_NO_TEMPORARY
create temporary table t1 (a int) partition by hash(a);
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -5820,4 +5820,5 @@ ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT ...@@ -5820,4 +5820,5 @@ ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT
eng "Cannot change the binary logging format inside a stored function or trigger" eng "Cannot change the binary logging format inside a stored function or trigger"
ER_NDB_CANT_SWITCH_BINLOG_FORMAT ER_NDB_CANT_SWITCH_BINLOG_FORMAT
eng "The NDB cluster engine does not support changing the binlog format on the fly yet" eng "The NDB cluster engine does not support changing the binlog format on the fly yet"
ER_PARTITION_NO_TEMPORARY
eng "Cannot create temporary table with partitions"
...@@ -2073,6 +2073,11 @@ bool mysql_create_table_internal(THD *thd, ...@@ -2073,6 +2073,11 @@ bool mysql_create_table_internal(THD *thd,
char *part_syntax_buf; char *part_syntax_buf;
uint syntax_len; uint syntax_len;
handlerton *engine_type; handlerton *engine_type;
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
my_error(ER_PARTITION_NO_TEMPORARY, MYF(0));
goto err;
}
while ((key= key_iterator++)) while ((key= key_iterator++))
{ {
if (key->type == Key::FOREIGN_KEY) if (key->type == Key::FOREIGN_KEY)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment