From 201f27702aff2e5029c23971d8c7a8335accbe7b Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Wed, 19 Nov 2003 23:11:27 +0100 Subject: [PATCH 1/7] ignore: added sql/udf_example.so scripts/make_win_src_distribution --- .bzrignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bzrignore b/.bzrignore index 7929adbf881..b2c877e16c5 100644 --- a/.bzrignore +++ b/.bzrignore @@ -335,3 +335,5 @@ innobase/stamp-h1 stamp-h1 configure.lineno innobase/configure.lineno +sql/udf_example.so +scripts/make_win_src_distribution From 9d3e8110240479d801341cb363b73991d266fcb7 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Tue, 25 Nov 2003 17:26:19 +0100 Subject: [PATCH 2/7] - The LGPL section was removed from manual.texi, hence we now use a local copy of COPYING.LIB (moved from the mysys subdirectory) instead of creating it on the fly out of the manual. --- mysys/COPYING.LIB => COPYING.LIB | 0 Docs/Makefile.am | 6 +----- 2 files changed, 1 insertion(+), 5 deletions(-) rename mysys/COPYING.LIB => COPYING.LIB (100%) diff --git a/mysys/COPYING.LIB b/COPYING.LIB similarity index 100% rename from mysys/COPYING.LIB rename to COPYING.LIB diff --git a/Docs/Makefile.am b/Docs/Makefile.am index 17450c3b072..eea93380b35 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -25,8 +25,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt INSTALL-BINARY all: $(targets) txt_files -txt_files: ../INSTALL-SOURCE ../COPYING ../COPYING.LIB \ - INSTALL-BINARY +txt_files: ../INSTALL-SOURCE ../COPYING INSTALL-BINARY CLEAN_FILES: $(BUILD_SOURCES) touch $(BUILD_SOURCES) @@ -142,8 +141,5 @@ INSTALL-BINARY: mysql.info $(GT) ../COPYING: mysql.info $(GT) perl -w $(GT) mysql.info "GPL license" "LGPL license" > $@ -../COPYING.LIB: mysql.info $(GT) - perl -w $(GT) mysql.info "LGPL license" "Function Index" > $@ - # Don't update the files from bitkeeper %::SCCS/s.% From 8702cb3337d765ce7dfe437ab63ac386604bf5a0 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Thu, 27 Nov 2003 09:35:55 +0100 Subject: [PATCH 3/7] fix contact person --- BitKeeper/etc/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BitKeeper/etc/config b/BitKeeper/etc/config index 85b5a871301..1faf57416f5 100644 --- a/BitKeeper/etc/config +++ b/BitKeeper/etc/config @@ -42,7 +42,7 @@ single_host: # discovers a problem which requires local intervention. Please make the # contact information accurate so we can support you. # -contact: Sasha Pachev +contact: sys@mysql.com # # It is very important that this email address is filled out and accurate. # If someone converts your repository to open logging (which you may not @@ -51,7 +51,7 @@ contact: Sasha Pachev # response from anyone else at your location after 90 days, then open logging # will be implicitly approved. # -email: sasha@mysql.com +email: sys@mysql.com # # Add your street address if you like, it is optional. # From 59004f01f9b1f285e57545afca715e61799840a6 Mon Sep 17 00:00:00 2001 From: "vva@eagle.mysql.r18.ru" <> Date: Tue, 16 Dec 2003 17:55:34 -0400 Subject: [PATCH 4/7] fixed restoring of thd->count_cuted_fields in store_val_in_field (fixed #bug 2012) --- mysql-test/r/insert_select.result | 12 ++++++++++++ mysql-test/t/insert_select.test | 31 +++++++++++++++++++++++++++++++ sql/sql_select.cc | 8 +++++++- 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index c754085ccb3..2435e28d7fe 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -11,3 +11,15 @@ payoutID 19 20 22 +Month Type Field Count +2003-09-01 1 1 100 +2003-09-01 1 2 100 +2003-09-01 2 1 100 +2003-09-01 2 2 100 +2003-09-01 3 1 100 +NULL Field Count +NULL 1 100 +NULL 2 100 +No Field Count +0 1 100 +0 2 100 diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index 17ecb2d5a1f..625f4755a79 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -10,3 +10,34 @@ insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1; insert into t2 (payoutID) SELECT payoutID+10 FROM t1; select * from t2; drop table t1,t2; + +# +# Another problem from Bug #2012 +# + +CREATE TABLE t1( + Month date NOT NULL, + Type tinyint(3) unsigned NOT NULL auto_increment, + Field int(10) unsigned NOT NULL, + Count int(10) unsigned NOT NULL, + UNIQUE KEY Month (Month,Type,Field) +); + +insert into t1 Values +(20030901, 1, 1, 100), +(20030901, 1, 2, 100), +(20030901, 2, 1, 100), +(20030901, 2, 2, 100), +(20030901, 3, 1, 100); + +select * from t1; + +Select null, Field, Count From t1 Where Month=20030901 and Type=2; + +create table t2(No int not null, Field int not null, Count int not null); + +insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2; + +select * from t2; + +drop table t1, t2; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 1230dffcaa9..26b1966ffed 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2184,9 +2184,15 @@ store_val_in_field(Field *field,Item *item) { THD *thd=current_thd; ulong cuted_fields=thd->cuted_fields; + /* + we should restore old value of count_cuted_fields because + store_val_in_field can be called from mysql_insert + with select_insert, which make count_cuted_fields= 1 + */ + bool old_count_cuted_fields= thd->count_cuted_fields; thd->count_cuted_fields=1; item->save_in_field(field); - thd->count_cuted_fields=0; + thd->count_cuted_fields= old_count_cuted_fields; return cuted_fields != thd->cuted_fields; } From d7f6ced15588a570d0366e59dd41e7988250dbd9 Mon Sep 17 00:00:00 2001 From: "vva@eagle.mysql.r18.ru" <> Date: Mon, 12 Jan 2004 22:47:26 -0400 Subject: [PATCH 5/7] Fixed Bug #2338 Trigonometric arithmetic problem by fixing optimizer bug with help of 'volatile' keyword --- mysql-test/r/func_math.result | 12 ++++++++++++ mysql-test/t/func_math.test | 11 +++++++++++ sql/item_func.cc | 6 ++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index e2723311682..5e774fe9886 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -20,3 +20,15 @@ PI() sin(pi()/2) cos(pi()/2) abs(tan(pi())) cot(1) asin(1) acos(0) atan(1) 3.141593 1.000000 0.000000 0.000000 0.64209262 1.570796 1.570796 0.785398 degrees(pi()) radians(360) 180 6.2831853071796 +ACOS(1.0) +0.000000 +ASIN(1.0) +1.570796 +ACOS(0.2*5.0) +0.000000 +ACOS(0.5*2.0) +0.000000 +ASIN(0.8+0.2) +1.570796 +ASIN(1.2-0.2) +1.570796 diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index 5299897d0f0..42ba8c73f69 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -13,3 +13,14 @@ select pow(10,log10(10)),power(2,4); select rand(999999),rand(); select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1); select degrees(pi()),radians(360); + +# +# Bug #2338 Trignometric arithmatic problems +# + +SELECT ACOS(1.0); +SELECT ASIN(1.0); +SELECT ACOS(0.2*5.0); +SELECT ACOS(0.5*2.0); +SELECT ASIN(0.8+0.2); +SELECT ASIN(1.2-0.2); diff --git a/sql/item_func.cc b/sql/item_func.cc index 217768db2c5..28a1c428cab 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -456,7 +456,8 @@ double Item_func_pow::val() double Item_func_acos::val() { - double value=args[0]->val(); + // this 'volatile' was added as a fix for BUG #2338 to calm optimizer down + volatile double value=args[0]->val(); if ((null_value=(args[0]->null_value || (value < -1.0 || value > 1.0)))) return 0.0; return fix_result(acos(value)); @@ -464,7 +465,8 @@ double Item_func_acos::val() double Item_func_asin::val() { - double value=args[0]->val(); + // this 'volatile' was added as a fix for BUG #2338 to calm optimizer down + volatile double value=args[0]->val(); if ((null_value=(args[0]->null_value || (value < -1.0 || value > 1.0)))) return 0.0; return fix_result(asin(value)); From 62f193bfdd458d8612158155100dcab23f00e262 Mon Sep 17 00:00:00 2001 From: "vva@eagle.mysql.r18.ru" <> Date: Tue, 3 Feb 2004 18:21:48 +0400 Subject: [PATCH 6/7] clean up comments --- sql/item_func.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/item_func.cc b/sql/item_func.cc index 28a1c428cab..037f7861630 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -456,7 +456,7 @@ double Item_func_pow::val() double Item_func_acos::val() { - // this 'volatile' was added as a fix for BUG #2338 to calm optimizer down + // the volatile's for BUG #2338 to calm optimizer down (because of gcc's bug) volatile double value=args[0]->val(); if ((null_value=(args[0]->null_value || (value < -1.0 || value > 1.0)))) return 0.0; @@ -465,7 +465,7 @@ double Item_func_acos::val() double Item_func_asin::val() { - // this 'volatile' was added as a fix for BUG #2338 to calm optimizer down + // the volatile's for BUG #2338 to calm optimizer down (because of gcc's bug) volatile double value=args[0]->val(); if ((null_value=(args[0]->null_value || (value < -1.0 || value > 1.0)))) return 0.0; From 2093624a732c5bec57db3460d2297356e07c4946 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Fri, 6 Feb 2004 14:28:57 +0300 Subject: [PATCH 7/7] Fix for bug #2628 "ALTER TABLE destroys table and reports success" --- BitKeeper/etc/logging_ok | 1 + mysql-test/r/alter_table.result | 8 ++++++++ mysql-test/t/alter_table.test | 17 +++++++++++++++++ sql/sql_table.cc | 18 ++++++++++++------ 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 777c590ce62..11a8f3b8fcd 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -12,6 +12,7 @@ heikki@donna.mysql.fi heikki@hundin.mysql.fi jani@hynda.mysql.fi jorge@linux.jorge.mysql.com +konstantin@mysql.com lenz@mysql.com miguel@hegel.(none) miguel@hegel.br diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index dbdbb7f57a9..8b104225b9c 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -32,3 +32,11 @@ i 2 3 4 +name +current +name +mysqltest +name +current +name +mysqltest diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index dbfbd4267d8..cfb4f958372 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -82,3 +82,20 @@ alter table t1 drop i,add i int unsigned not null auto_increment, drop primary k select * from t1; drop table t1; +# +# Bug #2628: 'alter table t1 rename mysqltest.t1' silently drops mysqltest.t1 +# if it exists +# +create table t1 (name char(15)); +insert into t1 (name) values ("current"); +create database mysqltest; +create table mysqltest.t1 (name char(15)); +insert into mysqltest.t1 (name) values ("mysqltest"); +select * from t1; +select * from mysqltest.t1; +--error 1050 +alter table t1 rename mysqltest.t1; +select * from t1; +select * from mysqltest.t1; +drop table t1; +drop database mysqltest; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f273821c5e0..04dfd8a1fbd 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1151,7 +1151,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, thd->proc_info="init"; table_name=table_list->real_name; db=table_list->db; - if (!new_db) + if (!new_db || !strcmp(new_db, db)) new_db=db; if (!(table=open_ltable(thd,table_list,TL_WRITE_ALLOW_READ))) @@ -1161,14 +1161,20 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, if (new_name) { strmov(new_name_buff,new_name); - fn_same(new_name_buff,table_name,3); if (lower_case_table_names) casedn_str(new_name); - if ((lower_case_table_names && - !my_strcasecmp(new_name_buff,table_name)) || - (!lower_case_table_names && + if (new_db == db && + (lower_case_table_names && + !my_strcasecmp(new_name_buff,table_name) || + !lower_case_table_names && !strcmp(new_name_buff,table_name))) - new_name=table_name; // No. Make later check easier + { + /* + Source and destination table names are equal: make later check + easier. + */ + new_name= table_name; + } else { if (table->tmp_table)