From f0cf742fd3e87dbe6cfb065bb371b1cbc93c00e5 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 6 Jan 2005 10:49:26 +0200 Subject: Fix for BUG#7331. The problem was that when a QUICK_SELECT access method is chosen, test_if_skip_sort_order() discovered that the index being used by the quick select will not deliver tuples in sorted order. In this case test_if_skip_sort_order() tried to change the index used by the quick select, but it didn't properly set the other members of the quick select, and especially the range flags of the ranges in QUICK_SELECT::ranges. The fix re-invokes the function SQL_SELECT::test_quick_select to correctly create a valid QUICK_SELECT object. mysql-test/r/order_by.result: Added test results. mysql-test/t/order_by.test: Added test for BUG#7331. sql/sql_select.cc: Fix for BUG#7331. --- mysql-test/r/order_by.result | 38 ++++++++++++++++++++++++++++++++++++++ mysql-test/t/order_by.test | 34 ++++++++++++++++++++++++++++++++++ sql/sql_select.cc | 21 +++++++++++++++++---- 3 files changed, 89 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 94d56bbc2fa..ab71a6b53e6 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -733,3 +733,41 @@ xxxxxxxxxxxxxxxxxxxaa xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxz drop table t1; +create table t1 ( +`sid` decimal(8,0) default null, +`wnid` varchar(11) not null default '', +key `wnid14` (`wnid`(4)), +key `wnid` (`wnid`) +) engine=myisam default charset=latin1; +insert into t1 (`sid`, `wnid`) values +('10100','01019000000'),('37986','01019000000'),('37987','01019010000'), +('39560','01019090000'),('37989','01019000000'),('37990','01019011000'), +('37991','01019011000'),('37992','01019019000'),('37993','01019030000'), +('37994','01019090000'),('475','02070000000'),('25253','02071100000'), +('25255','02071100000'),('25256','02071110000'),('25258','02071130000'), +('25259','02071190000'),('25260','02071200000'),('25261','02071210000'), +('25262','02071290000'),('25263','02071300000'),('25264','02071310000'), +('25265','02071310000'),('25266','02071320000'),('25267','02071320000'), +('25269','02071330000'),('25270','02071340000'),('25271','02071350000'), +('25272','02071360000'),('25273','02071370000'),('25281','02071391000'), +('25282','02071391000'),('25283','02071399000'),('25284','02071400000'), +('25285','02071410000'),('25286','02071410000'),('25287','02071420000'), +('25288','02071420000'),('25291','02071430000'),('25290','02071440000'), +('25292','02071450000'),('25293','02071460000'),('25294','02071470000'), +('25295','02071491000'),('25296','02071491000'),('25297','02071499000'); +explain select * from t1 where wnid like '0101%' order by wnid; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range wnid14,wnid wnid 11 NULL 10 Using where +select * from t1 where wnid like '0101%' order by wnid; +sid wnid +10100 01019000000 +37986 01019000000 +37989 01019000000 +37987 01019010000 +37990 01019011000 +37991 01019011000 +37992 01019019000 +37993 01019030000 +39560 01019090000 +37994 01019090000 +drop table t1; diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 988c106bf21..ab5e93603e4 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -500,3 +500,37 @@ insert into t1 set a = concat(repeat('x', 19), 'aa'); set max_sort_length=20; select a from t1 order by a; drop table t1; + +# +# Bug #7331 +# + +create table t1 ( + `sid` decimal(8,0) default null, + `wnid` varchar(11) not null default '', + key `wnid14` (`wnid`(4)), + key `wnid` (`wnid`) +) engine=myisam default charset=latin1; + +insert into t1 (`sid`, `wnid`) values +('10100','01019000000'),('37986','01019000000'),('37987','01019010000'), +('39560','01019090000'),('37989','01019000000'),('37990','01019011000'), +('37991','01019011000'),('37992','01019019000'),('37993','01019030000'), +('37994','01019090000'),('475','02070000000'),('25253','02071100000'), +('25255','02071100000'),('25256','02071110000'),('25258','02071130000'), +('25259','02071190000'),('25260','02071200000'),('25261','02071210000'), +('25262','02071290000'),('25263','02071300000'),('25264','02071310000'), +('25265','02071310000'),('25266','02071320000'),('25267','02071320000'), +('25269','02071330000'),('25270','02071340000'),('25271','02071350000'), +('25272','02071360000'),('25273','02071370000'),('25281','02071391000'), +('25282','02071391000'),('25283','02071399000'),('25284','02071400000'), +('25285','02071410000'),('25286','02071410000'),('25287','02071420000'), +('25288','02071420000'),('25291','02071430000'),('25290','02071440000'), +('25292','02071450000'),('25293','02071460000'),('25294','02071470000'), +('25295','02071491000'),('25296','02071491000'),('25297','02071499000'); + +explain select * from t1 where wnid like '0101%' order by wnid; + +select * from t1 where wnid like '0101%' order by wnid; + +drop table t1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 610a98d1983..acff1180e8c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7153,11 +7153,24 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, } else { - select->quick->file->ha_index_end(); - select->quick->index= new_ref_key; - select->quick->init(); + /* + The range optimizer constructed QUICK_RANGE for ref_key, and + we want to use instead new_ref_key as the index. We can't + just change the index of the quick select, because this may + result in an incosistent QUICK_SELECT object. Below we + create a new QUICK_SELECT from scratch so that all its + parameres are set correctly by the range optimizer. + */ + key_map new_ref_key_map; + new_ref_key_map.clear_all(); /* Force the creation of quick select */ + new_ref_key_map.set_bit(new_ref_key); /* only for new_ref_key. */ + + if (select->test_quick_select(tab->join->thd, new_ref_key_map, 0, + (tab->join->select_options & OPTION_FOUND_ROWS) ? + HA_POS_ERROR : tab->join->unit->select_limit_cnt) <= 0) + DBUG_RETURN(0); } - ref_key= new_ref_key; + ref_key= new_ref_key; } } /* Check if we get the rows in requested sorted order by using the key */ -- cgit v1.2.1 From 31457a625861d4dc3a99990eb42c38a81b607aef Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 15 Jan 2005 23:19:34 -0600 Subject: Bug #7922 prompt \p fails on Windows for shared-memory connections Fixed bug by adding code that displays the contents of mysql.host when \p is added as part of the prompt. mysql.cc: Added code to display mysql.host as prompt when using shared memory client/mysql.cc: Added code to display mysql.host as prompt when using shared memory BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + client/mysql.cc | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index d6ab5ae3180..aae5d908fe4 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -180,6 +180,7 @@ ram@mysql.r18.ru ram@ram.(none) ranger@regul.home.lan rburnett@build.mysql.com +reggie@bob.(none) root@home.(none) root@mc04.(none) root@x3.internalnet diff --git a/client/mysql.cc b/client/mysql.cc index 739cc77bd14..ebae8e636d2 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3232,13 +3232,20 @@ static const char* construct_prompt() break; } case 'p': + { #ifndef EMBEDDED_LIBRARY if (!connected) { processed_prompt.append("not_connected"); break; } - if (strstr(mysql_get_host_info(&mysql),"TCP/IP") || + + const char *host_info = mysql_get_host_info(&mysql); + if (strstr(host_info, "memory")) + { + processed_prompt.append( mysql.host ); + } + else if (strstr(host_info,"TCP/IP") || !mysql.unix_socket) add_int_to_prompt(mysql.port); else @@ -3247,6 +3254,7 @@ static const char* construct_prompt() processed_prompt.append(pos ? pos+1 : mysql.unix_socket); } #endif + } break; case 'U': if (!full_username) -- cgit v1.2.1 From c72207e143ac491dc23bd52fd14ecdf04113a107 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Jan 2005 09:27:24 +0400 Subject: libmysql.c: bug#7891: mysql_character_set_name() returns collation libmysql/libmysql.c: bug#7891: mysql_character_set_name() returns collation --- libmysql/libmysql.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index b180e86392d..10077e695f3 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1504,7 +1504,7 @@ ulong STDCALL mysql_thread_id(MYSQL *mysql) const char * STDCALL mysql_character_set_name(MYSQL *mysql) { - return mysql->charset->name; + return mysql->charset->csname; } -- cgit v1.2.1 From 7f69f44f0ab52f1634d80033b8e28a77b74a853c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Jan 2005 00:09:47 -0600 Subject: mysqldump.c: Move out-of-order option. client/mysqldump.c: Move out-of-order option. --- client/mysqldump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 14ebe9ea8f7..7280bea43f3 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -303,6 +303,9 @@ static struct my_option my_long_options[] = {"opt", OPT_OPTIMIZE, "Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"order-by-primary", OPT_ORDER_BY_PRIMARY, + "Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.", + (gptr*) &opt_order_by_primary, (gptr*) &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', "Password to use when connecting to server. If password is not given it's solicited on the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, @@ -354,9 +357,6 @@ static struct my_option my_long_options[] = {"socket", 'S', "Socket file to use for connection.", (gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"order-by-primary", OPT_ORDER_BY_PRIMARY, - "Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.", - (gptr*) &opt_order_by_primary, (gptr*) &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #include {"tab",'T', "Creates tab separated textfile for each table to given path. (creates .sql and .txt files). NOTE: This only works if mysqldump is run on the same machine as the mysqld daemon.", -- cgit v1.2.1 From b25fcad4a7ee8c8b54610609dd989b1e8b9ce3c5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Jan 2005 10:38:35 +0400 Subject: user_var.result, func_str.result, item_strfunc.cc: bug#7839 ncorrect collation for char(ascii('a')) sql/item_strfunc.cc: bug#7839 ncorrect collation for char(ascii('a')) mysql-test/r/func_str.result: bug#7839 ncorrect collation for char(ascii('a')) mysql-test/r/user_var.result: bug#7839 ncorrect collation for char(ascii('a')) --- mysql-test/r/func_str.result | 2 +- mysql-test/r/user_var.result | 4 ++-- sql/item_strfunc.cc | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 8348ef12b0d..0db62b133e7 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -463,7 +463,7 @@ collation(hex(130)) coercibility(hex(130)) latin1_swedish_ci 3 select collation(char(130)), coercibility(hex(130)); collation(char(130)) coercibility(hex(130)) -binary 3 +latin1_swedish_ci 3 select collation(format(130,10)), coercibility(format(130,10)); collation(format(130,10)) coercibility(format(130,10)) latin1_swedish_ci 3 diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index d46d6c7a78a..81846391795 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -175,7 +175,7 @@ Log_name Pos Event_type Server_id Orig_log_pos Info master-bin.000001 79 User var 1 79 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci master-bin.000001 120 Query 1 120 use `test`; INSERT INTO t1 VALUES(@`a b`) master-bin.000001 184 User var 1 184 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci -master-bin.000001 226 User var 1 226 @`var2`=_binary 0x61 COLLATE binary +master-bin.000001 226 User var 1 226 @`var2`=_latin1 0x61 COLLATE latin1_swedish_ci master-bin.000001 264 Query 1 264 use `test`; insert into t1 values (@var1),(@var2) /*!40019 SET @@session.max_insert_delayed_threads=0*/; SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`; @@ -183,7 +183,7 @@ use test; SET TIMESTAMP=10000; INSERT INTO t1 VALUES(@`a b`); SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`; -SET @`var2`:=_binary 0x61 COLLATE `binary`; +SET @`var2`:=_latin1 0x61 COLLATE `latin1_swedish_ci`; SET TIMESTAMP=10000; insert into t1 values (@var1),(@var2); drop table t1; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index d0190af042e..8341dda0a41 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1888,6 +1888,7 @@ b1: str->append((char)(num>>8)); #endif str->append((char)num); } + str->set_charset(collation.collation); str->realloc(str->length()); // Add end 0 (for Purify) return str; } -- cgit v1.2.1 From b01a4b33d5b83bbad406e58dfe85f987693b3480 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Jan 2005 13:23:56 +0400 Subject: func_str.result: after merge fix mysql-test/r/func_str.result: after merge fix --- mysql-test/r/func_str.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 2399099b478..1f78e5098f8 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -466,7 +466,7 @@ collation(hex(130)) coercibility(hex(130)) latin1_swedish_ci 3 select collation(char(130)), coercibility(hex(130)); collation(char(130)) coercibility(hex(130)) -binary 3 +latin1_swedish_ci 3 select collation(format(130,10)), coercibility(format(130,10)); collation(format(130,10)) coercibility(format(130,10)) latin1_swedish_ci 3 -- cgit v1.2.1 From 758769eef43fb2a2499491147ac2c2a78b9633be Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Jan 2005 13:58:16 +0400 Subject: user_var.result: after merge fix mysql-test/r/user_var.result: after merge fix --- mysql-test/r/user_var.result | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index d7d527dd720..69fcc5c45fe 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -172,23 +172,26 @@ SET TIMESTAMP=10000; SET @`a b`='hello'; INSERT INTO t1 VALUES(@`a b`); set @var1= "';aaa"; -insert into t1 values (@var1); +SET @var2=char(ascii('a')); +insert into t1 values (@var1),(@var2); show binlog events from 95; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 95 User var 1 136 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci master-bin.000001 136 Query 1 222 use `test`; INSERT INTO t1 VALUES(@`a b`) master-bin.000001 222 User var 1 264 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci -master-bin.000001 264 Query 1 350 use `test`; insert into t1 values (@var1) +master-bin.000001 264 User var 1 302 @`var2`=_latin1 0x61 COLLATE latin1_swedish_ci +master-bin.000001 302 Query 1 396 use `test`; insert into t1 values (@var1),(@var2) /*!40019 SET @@session.max_insert_delayed_threads=0*/; -SET @`a b`:=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci; +SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`; use test; SET TIMESTAMP=10000; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET @@session.sql_mode=0; INSERT INTO t1 VALUES(@`a b`); -SET @`var1`:=_latin1 0x273B616161 COLLATE latin1_swedish_ci; +SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`; +SET @`var2`:=_latin1 0x61 COLLATE `latin1_swedish_ci`; SET TIMESTAMP=10000; -insert into t1 values (@var1); +insert into t1 values (@var1),(@var2); drop table t1; set @var= NULL ; select FIELD( @var,'1it','Hit') as my_column; -- cgit v1.2.1 From a05bacb06ef33bf14439ee258c24dbeced10c3e4 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Jan 2005 12:29:43 +0100 Subject: Bug#7937 --- ndb/tools/restore/Restore.hpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/ndb/tools/restore/Restore.hpp b/ndb/tools/restore/Restore.hpp index e0b06c1774c..d7f6e3b7799 100644 --- a/ndb/tools/restore/Restore.hpp +++ b/ndb/tools/restore/Restore.hpp @@ -187,28 +187,33 @@ public: }; void update_max_auto_val(const char *data, int size) { - Uint64 val= 0; + union { + Uint8 u8; + Uint16 u16; + Uint32 u32; + } val; + Uint64 v; switch(size){ - case 8: - val= *(Uint8*)data; - break; - case 16: - val= *(Uint16*)data; - break; - case 24: - val= (0xffffff)&*(Uint32*)data; + case 64: + memcpy(&v,data,8); break; case 32: - val= *(Uint32*)data; + memcpy(&val.u32,data,4); + v= val.u32; break; - case 64: - val= *(Uint64*)data; + case 16: + memcpy(&val.u16,data,2); + v= val.u16; + break; + case 8: + memcpy(&val.u8,data,1); + v= val.u8; break; default: return; }; - if(val > m_max_auto_val) - m_max_auto_val= val; + if(v > m_max_auto_val) + m_max_auto_val= v; }; /** * Get attribute descriptor -- cgit v1.2.1 From 81c97e42f05eaa615e94ac62e551d02089f52130 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Jan 2005 17:19:33 +0200 Subject: Fix for BUG#7331 merged manually from 4.1. mysql-test/r/order_by.result: Test result for BUG#7331. mysql-test/t/order_by.test: Test for BUG#7331. sql/sql_select.cc: Fix for BUG#7331. --- mysql-test/r/order_by.result | 38 ++++++++++++++++++++++++++++++++++++++ mysql-test/t/order_by.test | 33 +++++++++++++++++++++++++++++++++ sql/sql_select.cc | 23 ++++++++++++++++------- 3 files changed, 87 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 6744ffa889f..5674fbb9177 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -740,3 +740,41 @@ a b 1 2 1 1 drop table t1; +create table t1 ( +`sid` decimal(8,0) default null, +`wnid` varchar(11) not null default '', +key `wnid14` (`wnid`(4)), +key `wnid` (`wnid`) +) engine=myisam default charset=latin1; +insert into t1 (`sid`, `wnid`) values +('10100','01019000000'),('37986','01019000000'),('37987','01019010000'), +('39560','01019090000'),('37989','01019000000'),('37990','01019011000'), +('37991','01019011000'),('37992','01019019000'),('37993','01019030000'), +('37994','01019090000'),('475','02070000000'),('25253','02071100000'), +('25255','02071100000'),('25256','02071110000'),('25258','02071130000'), +('25259','02071190000'),('25260','02071200000'),('25261','02071210000'), +('25262','02071290000'),('25263','02071300000'),('25264','02071310000'), +('25265','02071310000'),('25266','02071320000'),('25267','02071320000'), +('25269','02071330000'),('25270','02071340000'),('25271','02071350000'), +('25272','02071360000'),('25273','02071370000'),('25281','02071391000'), +('25282','02071391000'),('25283','02071399000'),('25284','02071400000'), +('25285','02071410000'),('25286','02071410000'),('25287','02071420000'), +('25288','02071420000'),('25291','02071430000'),('25290','02071440000'), +('25292','02071450000'),('25293','02071460000'),('25294','02071470000'), +('25295','02071491000'),('25296','02071491000'),('25297','02071499000'); +explain select * from t1 where wnid like '0101%' order by wnid; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range wnid14,wnid wnid 13 NULL 10 Using where +select * from t1 where wnid like '0101%' order by wnid; +sid wnid +10100 01019000000 +37986 01019000000 +37989 01019000000 +37987 01019010000 +37990 01019011000 +37991 01019011000 +37992 01019019000 +37993 01019030000 +39560 01019090000 +37994 01019090000 +drop table t1; diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index dd36cd95969..02e49f9750d 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -506,3 +506,36 @@ insert t1 values (1,1,1),(1,1,2),(1,2,1); select a, b from t1 group by a, b order by sum(c); drop table t1; +# +# Bug #7331 +# + +create table t1 ( + `sid` decimal(8,0) default null, + `wnid` varchar(11) not null default '', + key `wnid14` (`wnid`(4)), + key `wnid` (`wnid`) +) engine=myisam default charset=latin1; + +insert into t1 (`sid`, `wnid`) values +('10100','01019000000'),('37986','01019000000'),('37987','01019010000'), +('39560','01019090000'),('37989','01019000000'),('37990','01019011000'), +('37991','01019011000'),('37992','01019019000'),('37993','01019030000'), +('37994','01019090000'),('475','02070000000'),('25253','02071100000'), +('25255','02071100000'),('25256','02071110000'),('25258','02071130000'), +('25259','02071190000'),('25260','02071200000'),('25261','02071210000'), +('25262','02071290000'),('25263','02071300000'),('25264','02071310000'), +('25265','02071310000'),('25266','02071320000'),('25267','02071320000'), +('25269','02071330000'),('25270','02071340000'),('25271','02071350000'), +('25272','02071360000'),('25273','02071370000'),('25281','02071391000'), +('25282','02071391000'),('25283','02071399000'),('25284','02071400000'), +('25285','02071410000'),('25286','02071410000'),('25287','02071420000'), +('25288','02071420000'),('25291','02071430000'),('25290','02071440000'), +('25292','02071450000'),('25293','02071460000'),('25294','02071470000'), +('25295','02071491000'),('25296','02071491000'),('25297','02071499000'); + +explain select * from t1 where wnid like '0101%' order by wnid; + +select * from t1 where wnid like '0101%' order by wnid; + +drop table t1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0273334eca2..cf02d1c4f6e 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -10426,13 +10426,22 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, } else { - select->quick->head->file->ha_index_end(); - /* - We have verified above that select->quick is not - index_merge quick select. - */ - select->quick->index= new_ref_key; - select->quick->init(); + /* + The range optimizer constructed QUICK_RANGE for ref_key, and + we want to use instead new_ref_key as the index. We can't + just change the index of the quick select, because this may + result in an incosistent QUICK_SELECT object. Below we + create a new QUICK_SELECT from scratch so that all its + parameres are set correctly by the range optimizer. + */ + key_map new_ref_key_map; + new_ref_key_map.clear_all(); /* Force the creation of quick select */ + new_ref_key_map.set_bit(new_ref_key); /* only for new_ref_key. */ + + if (select->test_quick_select(tab->join->thd, new_ref_key_map, 0, + (tab->join->select_options & OPTION_FOUND_ROWS) ? + HA_POS_ERROR : tab->join->unit->select_limit_cnt) <= 0) + DBUG_RETURN(0); } ref_key= new_ref_key; } -- cgit v1.2.1 From 4fc1801d08b08dbb86f82cf83c11f5b90aaca745 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Jan 2005 19:21:01 +0300 Subject: Fixed memory leak in handle_local_infile() BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + libmysql/libmysql.c | 1 + 2 files changed, 2 insertions(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index d6ab5ae3180..7ff770e8fbb 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -93,6 +93,7 @@ joerg@mysql.com joreland@mysql.com jorge@linux.jorge.mysql.com jplindst@t41.(none) +kaa@polly.local kaj@work.mysql.com kent@mysql.com konstantin@mysql.com diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 10077e695f3..206fd8f77b4 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -852,6 +852,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename) err: /* free up memory allocated with _init, usually */ (*options->local_infile_end)(li_ptr); + my_free(buf, MYF(0)); DBUG_RETURN(result); } -- cgit v1.2.1 From 57f7c497cf397452cce36f50f546f0f1f85a2269 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Jan 2005 17:22:17 +0100 Subject: - Enabled the handling of architecture extensions e.g. "-64bit" when building Mac OS X PKGs with Do-pkg Build-tools/Do-pkg: - enable handling of architecture extensions e.g. "-64bit" --- Build-tools/Do-pkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build-tools/Do-pkg b/Build-tools/Do-pkg index 2fd1946ed0e..04d7ba021e5 100755 --- a/Build-tools/Do-pkg +++ b/Build-tools/Do-pkg @@ -84,7 +84,7 @@ $LOGFILE= "$PWD/Logs/$HOST-$MAJOR.$MINOR$SUFFIX.log"; $BUILDDIR= "$PWD/$HOST"; $SRCBASEDIR= <$BUILDDIR/mysql*-$VERSION>; $SUPFILEDIR= <$SRCBASEDIR/support-files/MacOSX>; -$TAR= <$BUILDDIR/$NAME-apple-darwin*-powerpc.tar.gz>; +$TAR= <$BUILDDIR/$NAME-apple-darwin*-powerpc*.tar.gz>; $TAR =~ /.*\/$NAME(.*)\.tar\.gz$/; $ARCH= $1; $NAME= $NAME . $ARCH; -- cgit v1.2.1 From 2524517978fe7a3d0f61a67bb7a558663b559cac Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Jan 2005 18:08:07 +0100 Subject: Allow "classic" builds (= without InnoDB) by eliminating an "unresolved reference" (bug#7961). sql/mysqld.cc: To allow builds without InnoDB ("classic"), the reference to 'innobase_use_checksums' must be guarded by an appropriate '#ifdef' (bug#7961). --- sql/mysqld.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b66d1ce3c24..ee59ed8c8a1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4449,9 +4449,11 @@ Disable with --skip-large-pages.", Disable with --skip-innodb (will save memory).", (gptr*) &opt_innodb, (gptr*) &opt_innodb, 0, GET_BOOL, NO_ARG, OPT_INNODB_DEFAULT, 0, 0, 0, 0, 0}, +#ifdef HAVE_INNOBASE_DB {"innodb_checksums", OPT_INNODB_CHECKSUMS, "Enable InnoDB checksums validation (enabled by default). \ Disable with --skip-innodb-checksums.", (gptr*) &innobase_use_checksums, (gptr*) &innobase_use_checksums, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, +#endif {"innodb_data_file_path", OPT_INNODB_DATA_FILE_PATH, "Path to individual files and their sizes.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -- cgit v1.2.1 From f9bcb9ab5cb6582c9bfe4ce3759b97868c22aa2f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Jan 2005 19:52:07 +0200 Subject: backported from 5.0 patch initialization of main select for commands where subqueries are possible --- sql/sql_yacc.yy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 4fcc72bc90e..1e51d8fb82d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4008,7 +4008,8 @@ insert: { LEX *lex= Lex; lex->sql_command= SQLCOM_INSERT; - lex->duplicates= DUP_ERROR; + lex->duplicates= DUP_ERROR; + mysql_init_select(lex); /* for subselects */ lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ; lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE; @@ -4028,6 +4029,7 @@ replace: LEX *lex=Lex; lex->sql_command = SQLCOM_REPLACE; lex->duplicates= DUP_REPLACE; + mysql_init_select(lex); lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE; } replace_lock_option insert2 @@ -4229,6 +4231,7 @@ delete: { LEX *lex= Lex; lex->sql_command= SQLCOM_DELETE; + mysql_init_select(lex); lex->lock_option= lex->thd->update_lock_default; lex->ignore= 0; lex->select_lex.init_order(); @@ -5321,6 +5324,7 @@ set: { LEX *lex=Lex; lex->sql_command= SQLCOM_SET_OPTION; + mysql_init_select(lex); lex->option_type=OPT_SESSION; lex->var_list.empty(); lex->one_shot_set= 0; -- cgit v1.2.1 From f6f90e7dc1ae497ac25941fc6b709f18a5d46c46 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Jan 2005 13:40:36 -0600 Subject: Bug #7966 query cache doesn't work properly with batch statements sql_lex.cc: Set query to not cacheable if we are using multistatements and there are multiple statements in this query sql/sql_lex.cc: Set query to not cacheable if we are using multistatements and there are multiple statements in this query --- sql/sql_lex.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 5730073bd35..2783406e16a 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -912,6 +912,7 @@ int yylex(void *arg, void *yythd) if ((thd->client_capabilities & CLIENT_MULTI_STATEMENTS) && (thd->command != COM_PREPARE)) { + lex->safe_to_cache_query=0; lex->found_colon=(char*)lex->ptr; thd->server_status |= SERVER_MORE_RESULTS_EXISTS; lex->next_state=MY_LEX_END; -- cgit v1.2.1 From 896cdbe5df80f942a43e784336052cb2cce5871c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 18 Jan 2005 02:04:41 +0200 Subject: Anoter fix for moved IO_CACHE object --- sql/filesort.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql/filesort.cc b/sql/filesort.cc index fe42f391007..a53067ccd73 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -686,7 +686,10 @@ int merge_many_buff(SORTPARAM *param, uchar *sort_buffer, } close_cached_file(to_file); // This holds old result if (to_file == t_file) + { *t_file=t_file2; // Copy result file + setup_io_cache(t_file); + } DBUG_RETURN(*maxbuffer >= MERGEBUFF2); /* Return 1 if interrupted */ } /* merge_many_buff */ -- cgit v1.2.1 From 96f64b4440daa411a887ded45d5cee1daca99360 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 18 Jan 2005 03:49:39 +0200 Subject: Fixed new bug that caused symlink test to fail mysys/my_symlink.c: More debugging --- myisam/mi_open.c | 2 +- mysys/my_symlink.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/myisam/mi_open.c b/myisam/mi_open.c index 442bf00b9d3..2a327e4bd35 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -142,7 +142,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) goto err; } /* Don't call realpath() if the name can't be a link */ - if (strcmp(name_buff, org_name) || + if (!strcmp(name_buff, org_name) || my_readlink(index_name, org_name, MYF(0)) == -1) (void) strmov(index_name, org_name); (void) fn_format(data_name,org_name,"",MI_NAME_DEXT,2+4+16); diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c index 045802c5e61..7be3fcd36f0 100644 --- a/mysys/my_symlink.c +++ b/mysys/my_symlink.c @@ -26,9 +26,11 @@ /* Reads the content of a symbolic link If the file is not a symbolic link, return the original file name in to. - Returns: 0 if table was a symlink, - 1 if table was a normal file - -1 on error. + + RETURN + 0 If filename was a symlink, (to will be set to value of symlink) + 1 If filename was a normal file (to will be set to filename) + -1 on error. */ int my_readlink(char *to, const char *filename, myf MyFlags) @@ -58,6 +60,7 @@ int my_readlink(char *to, const char *filename, myf MyFlags) } else to[length]=0; + DBUG_PRINT("exit" ,("result: %d", result)); DBUG_RETURN(result); #endif /* HAVE_READLINK */ } -- cgit v1.2.1 From a8afc137920db4e13f0b379204a3e765d9c28dd7 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 18 Jan 2005 05:07:22 +0200 Subject: After merge fixes mysql-test/r/order_by.result: After merge fix mysql-test/t/symlink.test: Comments --- mysql-test/r/order_by.result | 38 -------------------------------------- mysql-test/t/symlink.test | 10 ++++++++-- 2 files changed, 8 insertions(+), 40 deletions(-) diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index dd5f1ec732d..5674fbb9177 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -778,41 +778,3 @@ sid wnid 39560 01019090000 37994 01019090000 drop table t1; -create table t1 ( -`sid` decimal(8,0) default null, -`wnid` varchar(11) not null default '', -key `wnid14` (`wnid`(4)), -key `wnid` (`wnid`) -) engine=myisam default charset=latin1; -insert into t1 (`sid`, `wnid`) values -('10100','01019000000'),('37986','01019000000'),('37987','01019010000'), -('39560','01019090000'),('37989','01019000000'),('37990','01019011000'), -('37991','01019011000'),('37992','01019019000'),('37993','01019030000'), -('37994','01019090000'),('475','02070000000'),('25253','02071100000'), -('25255','02071100000'),('25256','02071110000'),('25258','02071130000'), -('25259','02071190000'),('25260','02071200000'),('25261','02071210000'), -('25262','02071290000'),('25263','02071300000'),('25264','02071310000'), -('25265','02071310000'),('25266','02071320000'),('25267','02071320000'), -('25269','02071330000'),('25270','02071340000'),('25271','02071350000'), -('25272','02071360000'),('25273','02071370000'),('25281','02071391000'), -('25282','02071391000'),('25283','02071399000'),('25284','02071400000'), -('25285','02071410000'),('25286','02071410000'),('25287','02071420000'), -('25288','02071420000'),('25291','02071430000'),('25290','02071440000'), -('25292','02071450000'),('25293','02071460000'),('25294','02071470000'), -('25295','02071491000'),('25296','02071491000'),('25297','02071499000'); -explain select * from t1 where wnid like '0101%' order by wnid; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range wnid14,wnid wnid 11 NULL 10 Using where -select * from t1 where wnid like '0101%' order by wnid; -sid wnid -10100 01019000000 -37986 01019000000 -37989 01019000000 -37987 01019010000 -37990 01019011000 -37991 01019011000 -37992 01019019000 -37993 01019030000 -39560 01019090000 -37994 01019090000 -drop table t1; diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index 78c9b68fde5..9e71ac4b925 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -49,8 +49,9 @@ check table t9; optimize table t9; repair table t9; alter table t9 add column c int not null; ---replace_result $MYSQL_TEST_DIR TEST_DIR -show create table t9; + +#--replace_result $MYSQL_TEST_DIR TEST_DIR +#show create table t9; # Test renames alter table t9 rename t8, add column d int not null; @@ -64,6 +65,9 @@ drop table t1; # Note that we are using the above table t9 here! # +--replace_result $MYSQL_TEST_DIR TEST_DIR +SHOW CREATE TABLE t9; + disable_query_log; --error 1103,1103 create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp"; @@ -78,9 +82,11 @@ create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, p --error 1103,1103 create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path"; +# Should fail becasue the file t9.MYI already exist in 'run' --error 1,1 eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="$MYSQL_TEST_DIR/var/run"; +# Should fail becasue the file t9.MYD already exist in 'tmp' --error 1,1 eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="$MYSQL_TEST_DIR/var/tmp"; enable_query_log; -- cgit v1.2.1 From ec0daa744fe6b1141e4d8815b574c2a1e38366e8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 18 Jan 2005 10:42:29 +0400 Subject: #7874: CONCAT() gives wrong results mixing latin1 field and utf8 string literals We should not overwrite res if it is returned from a const item. --- mysql-test/r/ctype_utf8.result | 12 ++++++++++++ mysql-test/t/ctype_utf8.test | 12 ++++++++++++ sql/item_strfunc.cc | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index f62d754392b..415ed33ad40 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -849,3 +849,15 @@ utf8_bin 6109 utf8_bin 61 utf8_bin 6120 drop table t1; +CREATE TABLE t1 ( +user varchar(255) NOT NULL default '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES ('one'),('two'); +SELECT CHARSET('a'); +CHARSET('a') +utf8 +SELECT user, CONCAT('<', user, '>') AS c FROM t1; +user c +one +two +DROP TABLE t1; diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index a57db4455ab..8e3eb71c3e5 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -681,3 +681,15 @@ SET collation_connection='utf8_general_ci'; -- source include/ctype_filesort.inc SET collation_connection='utf8_bin'; -- source include/ctype_filesort.inc + +# +# Bug #7874 CONCAT() gives wrong results mixing +# latin1 field and utf8 string literals +# +CREATE TABLE t1 ( + user varchar(255) NOT NULL default '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES ('one'),('two'); +SELECT CHARSET('a'); +SELECT user, CONCAT('<', user, '>') AS c FROM t1; +DROP TABLE t1; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 8341dda0a41..f131d849d62 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -275,7 +275,8 @@ String *Item_func_concat::val_str(String *str) current_thd->variables.max_allowed_packet); goto null; } - if (res->alloced_length() >= res->length()+res2->length()) + if (!args[0]->const_item() && + res->alloced_length() >= res->length()+res2->length()) { // Use old buffer res->append(*res2); } -- cgit v1.2.1