From ac69a4a22c7d2753631b81eb5fe7a5d05a272bf2 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Tue, 1 Mar 2005 19:05:48 -0800 Subject: [PATCH 1/4] Make sure that the filename for temporary tables is built with fn_format() so that extra slashes are handled in tmpdir. (Bug #8497) --- mysql-test/r/temp_table.result | 9 +++++++++ mysql-test/t/temp_table-master.opt | 1 + mysql-test/t/temp_table.test | 9 +++++++++ sql/ha_heap.cc | 6 ++++-- sql/sql_select.cc | 6 ++++-- 5 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 mysql-test/t/temp_table-master.opt 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 3c2249ce281..c7c466c019d 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; } @@ -521,7 +522,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 05314097ca3..3f763e5134a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4880,12 +4880,14 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &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); From 3a6af0b28fb12129be1f471ee65adc1c13836230 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Tue, 15 Mar 2005 17:33:06 -0800 Subject: [PATCH 2/4] Change mysql prompt while inside a multiline comment. (Bug #9186) --- client/mysql.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/mysql.cc b/client/mysql.cc index 46bfc7d880f..39d970da629 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -936,7 +936,8 @@ static int read_lines(bool execute_commands) } else { - char *prompt= (char*) (glob_buffer.is_empty() ? construct_prompt() : + char *prompt= (char*) (ml_comment ? " /*> " : + glob_buffer.is_empty() ? construct_prompt() : !in_string ? " -> " : in_string == '\'' ? " '> " : (in_string == '`' ? From bff994f86b319ed8bece36e7dfa13d92560be9a5 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Thu, 5 May 2005 04:56:30 -0700 Subject: [PATCH 3/4] Fix option handling of ./BUILD/compile-* to not try and pass options to configure. It was already changed not to support additional options, but now it was trying to pass all of the options to ./configure. (Bug #8648) --- BUILD/FINISH.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh index 094eb8275d6..143db3e0692 100644 --- a/BUILD/FINISH.sh +++ b/BUILD/FINISH.sh @@ -2,12 +2,6 @@ cflags="$c_warnings $extra_flags" cxxflags="$cxx_warnings $base_cxxflags $extra_flags" extra_configs="$extra_configs $local_infile_configs" configure="./configure $base_configs $extra_configs" -for arg -do - # Escape special characters so they don't confuse eval - configure="$configure "`echo "$arg" | \ - sed -e 's,\([^a-zA-Z0-9_.=-]\),\\\\\1,g'` -done commands="\ $make -k clean || true From bec93d485b5370548edd578e48fd94564c97abd0 Mon Sep 17 00:00:00 2001 From: "ramil@ram-book.(none)" <> Date: Fri, 6 May 2005 20:11:01 +0500 Subject: [PATCH 4/4] fix for bug #4082: Integer lengths cause truncation with DISTINCT CONCAT and InnoDB --- mysql-test/r/create.result | 8 ++++---- mysql-test/r/innodb.result | 6 ++++++ mysql-test/r/type_float.result | 2 +- mysql-test/t/innodb.test | 9 +++++++++ sql/item.cc | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 92c825f547d..123fdbd90bd 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -413,7 +413,7 @@ explain t2; Field Type Null Key Default Extra a int(11) YES NULL b bigint(11) 0 -c bigint(10) 0 +c bigint(11) 0 d date YES NULL e char(1) f datetime YES NULL @@ -432,11 +432,11 @@ Table Create Table t2 CREATE TABLE `t2` ( `ifnull(a,a)` tinyint(4) default NULL, `ifnull(b,b)` smallint(6) default NULL, - `ifnull(c,c)` mediumint(9) default NULL, + `ifnull(c,c)` mediumint(8) default NULL, `ifnull(d,d)` int(11) default NULL, `ifnull(e,e)` bigint(20) default NULL, - `ifnull(f,f)` float(3,2) default NULL, - `ifnull(g,g)` double(4,3) default NULL, + `ifnull(f,f)` float(24,2) default NULL, + `ifnull(g,g)` double(53,3) default NULL, `ifnull(h,h)` decimal(5,4) default NULL, `ifnull(i,i)` year(4) default NULL, `ifnull(j,j)` date default NULL, diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 6117b0a9a00..a8af3f5f658 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1637,3 +1637,9 @@ ERROR 42S21: Duplicate column name 'c1' alter table t1 add key (c1,c1,c2); ERROR 42S21: Duplicate column name 'c1' drop table t1; +create table t1(a int(1) , b int(1)) engine=innodb; +insert into t1 values ('1111', '3333'); +select distinct concat(a, b) from t1; +concat(a, b) +11113333 +drop table t1; diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 0906df8f621..319a957498b 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -92,7 +92,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `col1` double default NULL, - `col2` double(22,5) default NULL, + `col2` double(53,5) default NULL, `col3` double default NULL, `col4` double default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 7501889127a..4e18cfb224b 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1168,3 +1168,12 @@ alter table t1 add key (c1,c2,c1); --error 1060 alter table t1 add key (c1,c1,c2); drop table t1; + +# +# Bug #4082: integer truncation +# + +create table t1(a int(1) , b int(1)) engine=innodb; +insert into t1 values ('1111', '3333'); +select distinct concat(a, b) from t1; +drop table t1; diff --git a/sql/item.cc b/sql/item.cc index 211e165cc6b..6c1506e10e8 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -554,7 +554,7 @@ void Item_field::set_field(Field *field_par) { field=result_field=field_par; // for easy coding with fields maybe_null=field->maybe_null(); - max_length=field_par->field_length; + max_length=field_par->max_length(); decimals= field->decimals(); table_name=field_par->table_name; field_name=field_par->field_name;