summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-05-07 01:00:24 -0700
committerunknown <jimw@mysql.com>2005-05-07 01:00:24 -0700
commite28ddc8d7bf4b35dc4a358b4780fc7d189e357db (patch)
treebc8889afe473e104201c3a7e6c39c383cd375f23
parenta3a9677ab240b12fa7cc26e60251e562bd979d81 (diff)
parent1430a2a44319aa5ca1fa1b4e626fca7cec1243ad (diff)
downloadmariadb-git-e28ddc8d7bf4b35dc4a358b4780fc7d189e357db.tar.gz
Merge mysql.com:/home/jimw/my/mysql-4.1-8497
into mysql.com:/home/jimw/my/mysql-4.1-clean sql/ha_heap.cc: Auto merged sql/sql_select.cc: Auto merged
-rw-r--r--mysql-test/r/temp_table.result9
-rw-r--r--mysql-test/t/temp_table-master.opt1
-rw-r--r--mysql-test/t/temp_table.test9
-rw-r--r--sql/ha_heap.cc6
-rw-r--r--sql/sql_select.cc6
5 files changed, 27 insertions, 4 deletions
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index 10c0a2e3652..f08fe6ddd0f 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -97,3 +97,12 @@ Variable_name Value
Created_tmp_disk_tables 0
Created_tmp_tables 1
drop table t1;
+create table t1 (a int, b int, index(a), index(b));
+create table t2 (c int auto_increment, d varchar(255), primary key (c));
+insert into t1 values (3,1),(3,2);
+insert into t2 values (NULL, 'foo'), (NULL, 'bar');
+select d, c from t1 left join t2 on b = c where a = 3 order by d;
+d c
+bar 2
+foo 1
+drop table t1, t2;
diff --git a/mysql-test/t/temp_table-master.opt b/mysql-test/t/temp_table-master.opt
new file mode 100644
index 00000000000..026d3d4640c
--- /dev/null
+++ b/mysql-test/t/temp_table-master.opt
@@ -0,0 +1 @@
+--tmpdir=$MYSQL_TEST_DIR/var//tmp
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index 74276c7668c..3e60917783a 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -89,3 +89,12 @@ flush status;
select * from t1 group by d;
show status like "created_tmp%tables";
drop table t1;
+
+# Bug #8497: tmpdir with extra slashes would cause failures
+#
+create table t1 (a int, b int, index(a), index(b));
+create table t2 (c int auto_increment, d varchar(255), primary key (c));
+insert into t1 values (3,1),(3,2);
+insert into t2 values (NULL, 'foo'), (NULL, 'bar');
+select d, c from t1 left join t2 on b = c where a = 3 order by d;
+drop table t1, t2;
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index 4dc48c7422b..033fe86720e 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -408,7 +408,8 @@ THR_LOCK_DATA **ha_heap::store_lock(THD *thd,
int ha_heap::delete_table(const char *name)
{
char buff[FN_REFLEN];
- int error= heap_delete_table(fn_format(buff,name,"","",4+2));
+ int error= heap_delete_table(fn_format(buff,name,"","",
+ MY_REPLACE_EXT|MY_UNPACK_FILENAME));
return error == ENOENT ? 0 : error;
}
@@ -527,7 +528,8 @@ int ha_heap::create(const char *name, TABLE *table_arg,
create_info->auto_increment_value - 1 : 0);
hp_create_info.max_table_size=current_thd->variables.max_heap_table_size;
max_rows = (ha_rows) (hp_create_info.max_table_size / mem_per_row);
- error= heap_create(fn_format(buff,name,"","",4+2),
+ error= heap_create(fn_format(buff,name,"","",
+ MY_REPLACE_EXT|MY_UNPACK_FILENAME),
table_arg->keys,keydef, table_arg->reclength,
(ulong) ((table_arg->max_rows < max_rows &&
table_arg->max_rows) ?
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index aeb52a39982..1ff3328b8a8 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -5028,12 +5028,14 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
temp_pool_slot = bitmap_set_next(&temp_pool);
if (temp_pool_slot != MY_BIT_NONE) // we got a slot
- sprintf(path, "%s%s_%lx_%i", mysql_tmpdir, tmp_file_prefix,
+ sprintf(path, "%s_%lx_%i", tmp_file_prefix,
current_pid, temp_pool_slot);
else // if we run out of slots or we are not using tempool
- sprintf(path,"%s%s%lx_%lx_%x",mysql_tmpdir,tmp_file_prefix,current_pid,
+ sprintf(path,"%s%lx_%lx_%x", tmp_file_prefix,current_pid,
thd->thread_id, thd->tmp_table++);
+ fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME);
+
if (lower_case_table_names)
my_casedn_str(files_charset_info, path);