summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2009-09-09 14:38:50 +0500
committerSergey Vojtovich <svoj@sun.com>2009-09-09 14:38:50 +0500
commit3228a2be669f5d92a607b8212c9c3260a02fd47f (patch)
treeb69d77663d062ea4507970e9129641c120abda49 /sql/handler.cc
parenta00ba9ebea078f7dc12f7cd298782d1ada4bb4e9 (diff)
downloadmariadb-git-3228a2be669f5d92a607b8212c9c3260a02fd47f.tar.gz
BUG#45638 - Create temporary table with engine innodb fails
Create temporary InnoDB table fails on case insensitive filesystems, when lower_case_table_names is 2 (e.g. OS X) and temporary directory path contains upper case letters. The problem was that tmpdir prefix was converted to lower case when table was created, but was passed as is when table was opened. Fixed by leaving tmpdir prefix part intact. mysql-test/r/lowercase_mixed_tmpdir_innodb.result: A test case for BUG#45638. mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt: A test case for BUG#45638. mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh: A test case for BUG#45638. mysql-test/t/lowercase_mixed_tmpdir_innodb.test: A test case for BUG#45638. sql/handler.cc: Fixed get_canonical_filename() to not lowercase filesystem path prefix for temporary tables.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index e5c64452aaf..a4d88e84f4c 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1885,12 +1885,42 @@ bool ha_flush_logs(handlerton *db_type)
return FALSE;
}
+
+/**
+ @brief make canonical filename
+
+ @param[in] file table handler
+ @param[in] path original path
+ @param[out] tmp_path buffer for canonized path
+
+ @details Lower case db name and table name path parts for
+ non file based tables when lower_case_table_names
+ is 2 (store as is, compare in lower case).
+ Filesystem path prefix (mysql_data_home or tmpdir)
+ is left intact.
+
+ @note tmp_path may be left intact if no conversion was
+ performed.
+
+ @retval canonized path
+
+ @todo This may be done more efficiently when table path
+ gets built. Convert this function to something like
+ ASSERT_CANONICAL_FILENAME.
+*/
const char *get_canonical_filename(handler *file, const char *path,
char *tmp_path)
{
+ uint i;
if (lower_case_table_names != 2 || (file->ha_table_flags() & HA_FILE_BASED))
return path;
+ for (i= 0; i <= mysql_tmpdir_list.max; i++)
+ {
+ if (is_prefix(path, mysql_tmpdir_list.list[i]))
+ return path;
+ }
+
/* Ensure that table handler get path in lower case */
if (tmp_path != path)
strmov(tmp_path, path);