summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@sun.com>2010-05-21 14:18:14 +0200
committerMattias Jonsson <mattias.jonsson@sun.com>2010-05-21 14:18:14 +0200
commit6ef03ea37c5180621af9b5025e377141466bb2c9 (patch)
tree55f4f0b1a3c84d7bbb3afe29cbb9826e7071d863 /sql/sql_table.cc
parent37b02cd7d99278aec20e793c79ed105e99b2f7e7 (diff)
parentd72a15fcaaf55a5c5e6356524186ebd2a8705b70 (diff)
downloadmariadb-git-6ef03ea37c5180621af9b5025e377141466bb2c9.tar.gz
merge into mysql-5.1-bugteam
sql/ha_partition.cc: Bug#49477, added safety that a partitioned table cannot be temporary.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 2a2daacf724..873ac4e1659 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -5288,6 +5288,11 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
*/
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
+ if (src_table->table->file->ht == partition_hton)
+ {
+ my_error(ER_PARTITION_NO_TEMPORARY, MYF(0));
+ goto err;
+ }
if (find_temporary_table(thd, db, table_name))
goto table_exists;
dst_path_length= build_tmptable_filename(thd, dst_path, sizeof(dst_path));
@@ -5352,14 +5357,15 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
/*
For partitioned tables we need to copy the .par file as well since
it is used in open_table_def to even be able to create a new handler.
- There is no way to find out here if the original table is a
- partitioned table so we copy the file and ignore any errors.
*/
- fn_format(tmp_path, dst_path, reg_ext, ".par", MYF(MY_REPLACE_EXT));
- strmov(dst_path, tmp_path);
- fn_format(tmp_path, src_path, reg_ext, ".par", MYF(MY_REPLACE_EXT));
- strmov(src_path, tmp_path);
- my_copy(src_path, dst_path, MYF(MY_DONT_OVERWRITE_FILE));
+ if (src_table->table->file->ht == partition_hton)
+ {
+ fn_format(tmp_path, dst_path, reg_ext, ".par", MYF(MY_REPLACE_EXT));
+ strmov(dst_path, tmp_path);
+ fn_format(tmp_path, src_path, reg_ext, ".par", MYF(MY_REPLACE_EXT));
+ strmov(src_path, tmp_path);
+ my_copy(src_path, dst_path, MYF(MY_DONT_OVERWRITE_FILE));
+ }
#endif
DBUG_EXECUTE_IF("sleep_create_like_before_ha_create", my_sleep(6000000););