summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <tsmith@quadxeon.mysql.com>2007-04-30 23:16:46 +0200
committerunknown <tsmith@quadxeon.mysql.com>2007-04-30 23:16:46 +0200
commit36dea21b6c9b89878a1ba5da374752cdc76ce69a (patch)
tree7455fe54a47b6302204e11d4b5e6447e810080a9 /sql/sql_table.cc
parentb183fbbb182de8d9d59da68362f00a8c86a2c22d (diff)
downloadmariadb-git-36dea21b6c9b89878a1ba5da374752cdc76ce69a.tar.gz
Bug #27653: Temp table can't be created if lower_case_table_names=1 and
tmpdir has uppercase Fix: don't convert mysql_tmpdir to lower case when building the path to a temporary table mysql-test/include/have_lowercase1.inc: BitKeeper file /benchmarks/ext3/TOSAVE/tsmith/bk/maint/b27653/50/mysql-test/include/have_lowercase1.inc mysql-test/r/lowercase1.require: BitKeeper file /benchmarks/ext3/TOSAVE/tsmith/bk/maint/b27653/50/mysql-test/r/lowercase1.require mysql-test/r/lowercase_mixed_tmpdir.result: BitKeeper file /benchmarks/ext3/TOSAVE/tsmith/bk/maint/b27653/50/mysql-test/r/lowercase_mixed_tmpdir.result mysql-test/t/lowercase_mixed_tmpdir-master.opt: BitKeeper file /benchmarks/ext3/TOSAVE/tsmith/bk/maint/b27653/50/mysql-test/t/lowercase_mixed_tmpdir-master.opt mysql-test/t/lowercase_mixed_tmpdir-master.sh: BitKeeper file /benchmarks/ext3/TOSAVE/tsmith/bk/maint/b27653/50/mysql-test/t/lowercase_mixed_tmpdir-master.sh mysql-test/t/lowercase_mixed_tmpdir.test: BitKeeper file /benchmarks/ext3/TOSAVE/tsmith/bk/maint/b27653/50/mysql-test/t/lowercase_mixed_tmpdir.test sql/sql_table.cc: When building the path for a temporary table file, do not convert mysql_tmpdir to lower case; lower_case_table_names should not apply to mysql_tmpdir.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index f7478691293..42d59a10712 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -42,6 +42,7 @@ static int copy_data_between_tables(TABLE *from,TABLE *to,
static bool prepare_blob_field(THD *thd, create_field *sql_field);
static bool check_engine(THD *thd, const char *table_name,
enum db_type *new_engine);
+static void set_tmp_file_path(char *buf, size_t bufsize, THD *thd);
/*
@@ -1681,11 +1682,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
/* Check if table exists */
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
- my_snprintf(path, sizeof(path), "%s%s%lx_%lx_%x%s",
- mysql_tmpdir, tmp_file_prefix, current_pid, thd->thread_id,
- thd->tmp_table++, reg_ext);
- if (lower_case_table_names)
- my_casedn_str(files_charset_info, path);
+ set_tmp_file_path(path, sizeof(path), thd);
create_info->table_options|=HA_CREATE_DELAY_KEY_WRITE;
}
else
@@ -2801,11 +2798,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
{
if (find_temporary_table(thd, db, table_name))
goto table_exists;
- my_snprintf(dst_path, sizeof(dst_path), "%s%s%lx_%lx_%x%s",
- mysql_tmpdir, tmp_file_prefix, current_pid,
- thd->thread_id, thd->tmp_table++, reg_ext);
- if (lower_case_table_names)
- my_casedn_str(files_charset_info, dst_path);
+ set_tmp_file_path(dst_path, sizeof(dst_path), thd);
create_info->table_options|= HA_CREATE_DELAY_KEY_WRITE;
}
else
@@ -4319,3 +4312,16 @@ static bool check_engine(THD *thd, const char *table_name,
}
return FALSE;
}
+
+static void set_tmp_file_path(char *buf, size_t bufsize, THD *thd)
+{
+ char *p= strnmov(buf, mysql_tmpdir, bufsize);
+ my_snprintf(p, bufsize - (p - buf), "%s%lx_%lx_%x%s",
+ tmp_file_prefix, current_pid,
+ thd->thread_id, thd->tmp_table++, reg_ext);
+ if (lower_case_table_names)
+ {
+ /* Convert all except tmpdir to lower case */
+ my_casedn_str(files_charset_info, p);
+ }
+}