summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2010-08-02 12:01:24 +0300
committerMichael Widenius <monty@askmonty.org>2010-08-02 12:01:24 +0300
commite0a6b02c5d0a311e7167295494786077009743d1 (patch)
tree72c934fe42261ad5de3139961e092f57e9d147df /sql/sql_table.cc
parentd2f8b7d04503478ab6b6998194a2070891f0c2bb (diff)
parent6ad06b15222300e4eed4fe3972d1ad249c4c42a2 (diff)
downloadmariadb-git-e0a6b02c5d0a311e7167295494786077009743d1.tar.gz
Merge with MySQL 5.1.49
Fixed Bug#52005 'JOIN_TAB->dependent' may be incorrectly propageted for multilevel outer joins' in a better way (patch from Sergey Petrunya)
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc45
1 files changed, 34 insertions, 11 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 15cc162f6ab..3c1fbff6617 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -392,6 +392,25 @@ uint filename_to_tablename(const char *from, char *to, uint to_length)
/**
+ Check if given string begins with "#mysql50#" prefix
+
+ @param name string to check cut
+
+ @retval
+ FALSE no prefix found
+ @retval
+ TRUE prefix found
+*/
+
+bool check_mysql50_prefix(const char *name)
+{
+ return (name[0] == '#' &&
+ !strncmp(name, MYSQL50_TABLE_NAME_PREFIX,
+ MYSQL50_TABLE_NAME_PREFIX_LENGTH));
+}
+
+
+/**
Check if given string begins with "#mysql50#" prefix, cut it if so.
@param from string to check and cut
@@ -406,9 +425,7 @@ uint filename_to_tablename(const char *from, char *to, uint to_length)
uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length)
{
- if (from[0] == '#' &&
- !strncmp(from, MYSQL50_TABLE_NAME_PREFIX,
- MYSQL50_TABLE_NAME_PREFIX_LENGTH))
+ if (check_mysql50_prefix(from))
return (uint) (strmake(to, from + MYSQL50_TABLE_NAME_PREFIX_LENGTH,
to_length - 1) - to);
return 0;
@@ -4586,7 +4603,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
table->next_global= 0;
save_next_local= table->next_local;
table->next_local= 0;
- select->table_list.first= (uchar*)table;
+ select->table_list.first= table;
/*
Time zone tables and SP tables can be add to lex->query_tables list,
so it have to be prepared.
@@ -5300,6 +5317,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));
@@ -5364,14 +5386,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););