From c12c5b4e4c3db1ccda46418c2078aeffb97a85fc Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Tue, 25 Jan 2005 12:24:50 -0800 Subject: [PATCH 01/22] Add BUG# to subject and X-Bug header for all outgoing emails re: bug fixes, and update the URL for the manual page on installing from the source tree. Fake bug number for testing: Bug #1234 --- BitKeeper/triggers/post-commit | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/BitKeeper/triggers/post-commit b/BitKeeper/triggers/post-commit index 1c4608835d6..5dc351024e0 100755 --- a/BitKeeper/triggers/post-commit +++ b/BitKeeper/triggers/post-commit @@ -20,13 +20,19 @@ if [ "$BK_STATUS" = OK ] then CHANGESET=`bk -R prs -r+ -h -d':P:::I:' ChangeSet` -BUG=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Bb][Uu][Gg] *# *\([0-9][0-9]*\).*$/ BUG#\1/p'` +BUG=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Bb][Uu][Gg] *# *\([0-9][0-9]*\).*$/\1/p'` if [ "$BUG" = "" ] then TO=dev-public@mysql.com + BS="" + BH="" else TO=dev-bugs@mysql.com + BS=" BUG#$BUG" +# need newline here + BH="X-Bug: $BUG +" fi #++ # dev-public@ / dev-bugs@ @@ -37,8 +43,8 @@ fi List-ID: From: $FROM To: $TO -Subject: bk commit - $VERSION tree ($CHANGESET)$BUG - +Subject: bk commit - $VERSION tree ($CHANGESET)$BS +$BH EOF bk changes -v -r+ bk cset -r+ -d @@ -53,14 +59,15 @@ EOF List-ID: From: $FROM To: $INTERNALS -Subject: bk commit into $VERSION tree ($CHANGESET) +Subject: bk commit into $VERSION tree ($CHANGESET)$BS +$BH Below is the list of changes that have just been committed into a local $VERSION repository of $USER. When $USER does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository -see http://www.mysql.com/doc/I/n/Installing_source_tree.html +see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html EOF bk changes -v -r+ @@ -80,7 +87,7 @@ EOF List-ID: From: $FROM To: $DOCS -Subject: bk commit - $VERSION tree (Manual) ($CHANGESET) +Subject: bk commit - $VERSION tree (Manual) ($CHANGESET)$BS EOF bk changes -v -r+ From a2df0fdfb070817802a0273b9c2d93b874d39151 Mon Sep 17 00:00:00 2001 From: "ram@gw.mysql.r18.ru" <> Date: Tue, 1 Feb 2005 18:35:09 +0400 Subject: [PATCH 02/22] A fix (bug #7971: set_bit/clear_bit names conflict w/Linux kernel headers >= 2.6.9-rcxx) --- extra/replace.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/extra/replace.c b/extra/replace.c index 5444f443382..706d4941768 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -376,8 +376,8 @@ static REP_SET *make_new_set(REP_SETS *sets); static void make_sets_invisible(REP_SETS *sets); static void free_last_set(REP_SETS *sets); static void free_sets(REP_SETS *sets); -static void set_bit(REP_SET *set, uint bit); -static void clear_bit(REP_SET *set, uint bit); +static void internal_set_bit(REP_SET *set, uint bit); +static void internal_clear_bit(REP_SET *set, uint bit); static void or_bits(REP_SET *to,REP_SET *from); static void copy_bits(REP_SET *to,REP_SET *from); static int cmp_bits(REP_SET *set1,REP_SET *set2); @@ -454,7 +454,7 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count, { if (from[i][0] == '\\' && from[i][1] == '^') { - set_bit(start_states,states+1); + internal_set_bit(start_states,states+1); if (!from[i][2]) { start_states->table_offset=i; @@ -463,8 +463,8 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count, } else if (from[i][0] == '\\' && from[i][1] == '$') { - set_bit(start_states,states); - set_bit(word_states,states); + internal_set_bit(start_states,states); + internal_set_bit(word_states,states); if (!from[i][2] && start_states->table_offset == (uint) ~0) { start_states->table_offset=i; @@ -473,11 +473,11 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count, } else { - set_bit(word_states,states); + internal_set_bit(word_states,states); if (from[i][0] == '\\' && (from[i][1] == 'b' && from[i][2])) - set_bit(start_states,states+1); + internal_set_bit(start_states,states+1); else - set_bit(start_states,states); + internal_set_bit(start_states,states); } for (pos=from[i], len=0; *pos ; pos++) { @@ -583,9 +583,9 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count, follow[i].len > found_end) found_end=follow[i].len; if (chr && follow[i].chr) - set_bit(new_set,i+1); /* To next set */ + internal_set_bit(new_set,i+1); /* To next set */ else - set_bit(new_set,i); + internal_set_bit(new_set,i); } } if (found_end) @@ -602,7 +602,7 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count, if (follow[bit_nr-1].len < found_end || (new_set->found_len && (chr == 0 || !follow[bit_nr].chr))) - clear_bit(new_set,i); + internal_clear_bit(new_set,i); else { if (chr == 0 || !follow[bit_nr].chr) @@ -751,13 +751,13 @@ static void free_sets(REP_SETS *sets) return; } -static void set_bit(REP_SET *set, uint bit) +static void internal_set_bit(REP_SET *set, uint bit) { set->bits[bit / WORD_BIT] |= 1 << (bit % WORD_BIT); return; } -static void clear_bit(REP_SET *set, uint bit) +static void internal_clear_bit(REP_SET *set, uint bit) { set->bits[bit / WORD_BIT] &= ~ (1 << (bit % WORD_BIT)); return; From 016544df2276f3bb0471e3638416c1ecc378c710 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Thu, 10 Feb 2005 14:56:20 +0300 Subject: [PATCH 03/22] A fix and test case for Bug#8330 "mysql_stmt_execute crashes" (libmysql). --- libmysql/libmysql.c | 5 ++++ tests/mysql_client_test.c | 54 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 3d84059e981..24a7fa5f929 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -2467,6 +2467,11 @@ int cli_stmt_execute(MYSQL_STMT *stmt) set_stmt_error(stmt, CR_PARAMS_NOT_BOUND, unknown_sqlstate); DBUG_RETURN(1); } + if (stmt->mysql->status != MYSQL_STATUS_READY) + { + set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate); + DBUG_RETURN(1); + } net_clear(net); /* Sets net->write_pos */ /* Reserve place for null-marker bytes */ diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 83f8f6ab143..e4bdd1d350a 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -11532,6 +11533,58 @@ static void test_bug6761(void) myquery(rc); } + +/* Bug#8330 - Bug #8330 mysql_stmt_execute crashes (libmysql) */ + +static void test_bug8330() +{ + const char *stmt_text; + MYSQL_STMT *stmt[2]; + int i, rc; + char *query= "select a,b from t1 where a=?"; + MYSQL_BIND bind[2]; + long lval[2]; + + myheader("test_bug8330"); + + stmt_text= "drop table if exists t1"; + /* in case some previos test failed */ + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + stmt_text= "create table t1 (a int, b int)"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + + bzero(bind, sizeof(bind)); + for (i=0; i < 2; i++) + { + stmt[i]= mysql_stmt_init(mysql); + rc= mysql_stmt_prepare(stmt[i], query, strlen(query)); + check_execute(stmt[i], rc); + + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void*) &lval[i]; + bind[i].is_null= 0; + mysql_stmt_bind_param(stmt[i], &bind[i]); + } + + rc= mysql_stmt_execute(stmt[0]); + check_execute(stmt[0], rc); + + rc= mysql_stmt_execute(stmt[1]); + DIE_UNLESS(rc && mysql_stmt_errno(stmt[1]) == CR_COMMANDS_OUT_OF_SYNC); + rc= mysql_stmt_execute(stmt[0]); + check_execute(stmt[0], rc); + + mysql_stmt_close(stmt[0]); + mysql_stmt_close(stmt[1]); + + stmt_text= "drop table t1"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -11739,6 +11792,7 @@ static struct my_tests_st my_tests[]= { { "test_conversion", test_conversion }, { "test_rewind", test_rewind }, { "test_bug6761", test_bug6761 }, + { "test_bug8330", test_bug8330 }, { 0, 0 } }; From a710d1063752411105a8c38f72f71f558cb4b1b6 Mon Sep 17 00:00:00 2001 From: "joerg@mysql.com" <> Date: Thu, 10 Feb 2005 14:33:27 +0100 Subject: [PATCH 04/22] Change 'Build-tools/Do-compile' from 'system("rm -f ...");' to 'unlink()' to ensure it also works on file names with special characters. --- Build-tools/Do-compile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index af03f3209aa..1f83a9a37e1 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -729,7 +729,7 @@ sub find sub rm_all { my(@rm_files)=@_; - my($dir,$current_dir,@files,@dirs); + my($dir,$current_dir,@files,@dirs,$removed); $current_dir = `pwd`; chomp($current_dir); foreach $dir (@rm_files) @@ -753,7 +753,9 @@ sub rm_all } if ($#files >= 0) { - system("rm -f " . join(" ",@files)) && abort("Can't remove files from $dir"); + $removed= unlink @files; + print "rm_all : removed $removed files in $current_dir/$dir\n" if ($opt_debug); + abort("Can't remove all $#files+1 from $current_dir/$dir, just $removed") if $removed != $#files+1; } foreach $dir (@dirs) { From 4b2b327dccfb2acc2903d83a5611045987e47183 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Thu, 10 Feb 2005 17:41:54 +0300 Subject: [PATCH 05/22] A fix and test case for Bug#7990 "mysql_stmt_close doesn't reset mysql->net.last_error": the solution is to clear MYSQL->net error before performing COM_CLOSE: if the call succeeds, the connection is usable for other statements. More comprehensive fix is to clear MYSQL->net for all recoverable errors at the time they happen, it will be implemented in 5.0 as it introduces incompatibility in behavior. --- libmysql/libmysql.c | 17 +++++++++++++++++ tests/mysql_client_test.c | 22 +++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 24a7fa5f929..76cf5c3913c 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1788,6 +1788,18 @@ static my_bool my_realloc_str(NET *net, ulong length) } +/* Clear possible error statee of struct NET */ + +static void net_clear_error(NET *net) +{ + if (net->last_errno) + { + net->last_errno= 0; + net->last_error[0]= '\0'; + strmov(net->sqlstate, not_error_sqlstate); + } +} + /* Set statement error code, sqlstate, and error message from given errcode and sqlstate. @@ -4512,6 +4524,11 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt) if (mysql->unbuffered_fetch_owner == &stmt->unbuffered_fetch_cancelled) mysql->unbuffered_fetch_owner= 0; + /* + Clear NET error state: if the following commands come through + successfully, connection will still be usable for other commands. + */ + net_clear_error(&mysql->net); if (mysql->status != MYSQL_STATUS_READY) { /* diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index e4bdd1d350a..2c7a8fdb635 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11534,7 +11534,7 @@ static void test_bug6761(void) } -/* Bug#8330 - Bug #8330 mysql_stmt_execute crashes (libmysql) */ +/* Bug#8330 - mysql_stmt_execute crashes (libmysql) */ static void test_bug8330() { @@ -11585,6 +11585,26 @@ static void test_bug8330() } +/* Bug#7990 - mysql_stmt_close doesn't reset mysql->net.last_error */ + +static void test_bug7990() +{ + MYSQL_STMT *stmt; + int rc; + myheader("test_bug7990"); + + stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_prepare(stmt, "foo", 3); + /* + XXX: the fact that we store errno both in STMT and in + MYSQL is not documented and is subject to change in 5.0 + */ + DIE_UNLESS(rc && mysql_stmt_errno(stmt) && mysql_errno(mysql)); + mysql_stmt_close(stmt); + DIE_UNLESS(!mysql_errno(mysql)); +} + + /* Read and parse arguments and MySQL options from my.cnf */ From 36c992b264eca68467659f4aeb475ad6c0a53704 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Thu, 10 Feb 2005 18:24:26 +0300 Subject: [PATCH 06/22] Follow-up for bug#7990 --- libmysql/libmysql.c | 10 +++++----- tests/mysql_client_test.c | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 76cf5c3913c..9c49c7eb15b 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -4518,17 +4518,17 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt) if (mysql) { mysql->stmts= list_delete(mysql->stmts, &stmt->list); + /* + Clear NET error state: if the following commands come through + successfully, connection will still be usable for other commands. + */ + net_clear_error(&mysql->net); if ((int) stmt->state > (int) MYSQL_STMT_INIT_DONE) { char buff[MYSQL_STMT_HEADER]; /* 4 bytes - stmt id */ if (mysql->unbuffered_fetch_owner == &stmt->unbuffered_fetch_cancelled) mysql->unbuffered_fetch_owner= 0; - /* - Clear NET error state: if the following commands come through - successfully, connection will still be usable for other commands. - */ - net_clear_error(&mysql->net); if (mysql->status != MYSQL_STATUS_READY) { /* diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 2c7a8fdb635..14b3ddbf8b2 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11813,6 +11813,7 @@ static struct my_tests_st my_tests[]= { { "test_rewind", test_rewind }, { "test_bug6761", test_bug6761 }, { "test_bug8330", test_bug8330 }, + { "test_bug7990", test_bug7990 }, { 0, 0 } }; From 35f65c5a06792b05d3af6ab9e9d35f0ab1f4c6b8 Mon Sep 17 00:00:00 2001 From: "ingo@mysql.com" <> Date: Thu, 10 Feb 2005 16:56:57 +0100 Subject: [PATCH 07/22] Bug#8391 - "merge" fails on Linux/IA64 It was a thread stack overrun. IA64 had its own stack size section already. Enlarged its default stack size from 192K to 256K. --- include/my_pthread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/my_pthread.h b/include/my_pthread.h index c4138a47b3c..f8cd3e0de71 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -637,7 +637,7 @@ extern int pthread_dummy(int); MySQL can survive with 32K, but some glibc libraries require > 128K stack To resolve hostnames */ -#define DEFAULT_THREAD_STACK (192*1024L) +#define DEFAULT_THREAD_STACK (256*1024L) #else #define DEFAULT_THREAD_STACK (192*1024) #endif From bef05eda10d384a22b4ce2151bacea41fe390b54 Mon Sep 17 00:00:00 2001 From: "lars@mysql.com" <> Date: Thu, 10 Feb 2005 21:23:48 +0100 Subject: [PATCH 08/22] BUG#6749: If there is no current database, then nothing should be binlogged if binlog-do-db or binlog-ignore-db are in effect. (In the future 5.1? 5.0? I think each statement should be verified against the filtering criteria based on the database it *uses* and not the *current* one. But, right now the *current* database is what counts according to the semantics of the manual.) --- sql/log.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/log.cc b/sql/log.cc index 38844877f1b..46b44837e0f 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1274,7 +1274,7 @@ bool MYSQL_LOG::write(Log_event* event_info) binlog_[wild_]{do|ignore}_table?" (WL#1049)" */ if ((thd && !(thd->options & OPTION_BIN_LOG)) || - (local_db && !db_ok(local_db, binlog_do_db, binlog_ignore_db))) + (!db_ok(local_db, binlog_do_db, binlog_ignore_db))) { VOID(pthread_mutex_unlock(&LOCK_log)); DBUG_PRINT("error",("!db_ok('%s')", local_db)); From 29af4dffe612cef5813ac634a61297581daf30ec Mon Sep 17 00:00:00 2001 From: "brian@zim.(none)" <> Date: Thu, 10 Feb 2005 19:04:38 -0800 Subject: [PATCH 09/22] Set of fixes requested by Kent in IRC. Tested (except the windows changes since I am trusting Kent...). No windows compiles here folks... --- VC++Files/tests/mysql_client_test.dsp | 12 ++++++------ sql/item.cc | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/VC++Files/tests/mysql_client_test.dsp b/VC++Files/tests/mysql_client_test.dsp index 07014487bd1..3d1e6728181 100644 --- a/VC++Files/tests/mysql_client_test.dsp +++ b/VC++Files/tests/mysql_client_test.dsp @@ -66,18 +66,18 @@ LINK32=link.exe # PROP Output_Dir ".\Release" # PROP Intermediate_Dir ".\Release" # PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/client_test.pch" /Fo".\Release/" /Fd".\Release/" /c /GX -# ADD CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/client_test.pch" /Fo".\Release/" /Fd".\Release/" /c /GX -# ADD BASE MTL /nologo /tlb".\Release\client_test.tlb" /win32 -# ADD MTL /nologo /tlb".\Release\client_test.tlb" /win32 +# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_client_test.pch" /Fo".\Release/" /Fd".\Release/" /c /GX +# ADD CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_client_test.pch" /Fo".\Release/" /Fd".\Release/" /c /GX +# ADD BASE MTL /nologo /tlb".\Release\mysql_client_test.tlb" /win32 +# ADD MTL /nologo /tlb".\Release\mysql_client_test.tlb" /win32 # ADD BASE RSC /l 1033 # ADD RSC /l 1033 BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\tests\client_test.exe" /incremental:no /pdb:".\Release\client_test.pdb" /pdbtype:sept /subsystem:console -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\tests\client_test.exe" /incremental:no /pdb:".\Release\client_test.pdb" /pdbtype:sept /subsystem:console +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\tests\mysql_client_test.exe" /incremental:no /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\tests\mysql_client_test.exe" /incremental:no /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console !ENDIF diff --git a/sql/item.cc b/sql/item.cc index 17d41fda677..4b3acbe5a3c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2797,7 +2797,7 @@ bool Item_type_holder::join_types(THD *thd, Item *item, TABLE *table) bool use_new_field= 0, use_expression_type= 0; Item_result new_result_type= type_convertor[item_type][item->result_type()]; Field *field= get_holder_example_field(thd, item, table); - bool item_is_a_field= field; + bool item_is_a_field= (field != NULL); /* Check if both items point to fields: in this case we can adjust column types of result table in the union smartly. From 6daef0229c2a2194f023c0f62bf6e2ddea8499a4 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Thu, 10 Feb 2005 20:31:23 -0800 Subject: [PATCH 10/22] Fix extra blank line in emails sent by post-commit trigger. --- BitKeeper/triggers/post-commit | 1 - 1 file changed, 1 deletion(-) diff --git a/BitKeeper/triggers/post-commit b/BitKeeper/triggers/post-commit index 5dc351024e0..a38b1f5a068 100755 --- a/BitKeeper/triggers/post-commit +++ b/BitKeeper/triggers/post-commit @@ -61,7 +61,6 @@ From: $FROM To: $INTERNALS Subject: bk commit into $VERSION tree ($CHANGESET)$BS $BH - Below is the list of changes that have just been committed into a local $VERSION repository of $USER. When $USER does a push these changes will be propagated to the main repository and, within 24 hours after the From 8b3d59ad428495b983ff66a5e1ec3f5db83dd994 Mon Sep 17 00:00:00 2001 From: "igor@rurik.mysql.com" <> Date: Thu, 10 Feb 2005 22:15:38 -0800 Subject: [PATCH 11/22] select.result, select.test: Added a test case for bug #7520. table.cc: Fixed bug #7520. The bug was caused by a wrong calculation of the field max_key_length for a TABLE structure when there was an index on a blob field. --- mysql-test/r/select.result | 13 +++++++++++++ mysql-test/t/select.test | 15 +++++++++++++++ sql/table.cc | 1 + 3 files changed, 29 insertions(+) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index cc90547722f..4c6ad1c34f0 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2364,3 +2364,16 @@ EXPLAIN SELECT i FROM t1 WHERE i=1; table type possible_keys key key_len ref rows Extra t1 const PRIMARY PRIMARY 4 const 1 Using index DROP TABLE t1; +CREATE TABLE t1 ( a BLOB, INDEX (a(20)) ); +CREATE TABLE t2 ( a BLOB, INDEX (a(20)) ); +INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five'); +INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a; +table type possible_keys key key_len ref rows Extra +t1 ALL NULL NULL NULL NULL 5 +t2 ref a a 23 t1.a 5 +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; +table type possible_keys key key_len ref rows Extra +t1 ALL NULL NULL NULL NULL 5 +t2 ref a a 23 t1.a 5 +DROP TABLE t1, t2; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index e6b1ffbe8d7..9be08b8390b 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -1909,3 +1909,18 @@ EXPLAIN SELECT i FROM t1 WHERE i=1; EXPLAIN SELECT i FROM t1 WHERE i=1; DROP TABLE t1; + +# +# Test case for bug 7520: a wrong cost of the index for a BLOB field +# + +CREATE TABLE t1 ( a BLOB, INDEX (a(20)) ); +CREATE TABLE t2 ( a BLOB, INDEX (a(20)) ); + +INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five'); +INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); + +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a; +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; + +DROP TABLE t1, t2; diff --git a/sql/table.cc b/sql/table.cc index 573fa11a4c4..244c7fa94f3 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -486,6 +486,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, if (!(field->flags & BINARY_FLAG)) keyinfo->flags|= HA_END_SPACE_KEY; } + set_if_bigger(outparam->max_key_length, keyinfo->key_length); if (i == 0 && key != primary_key) field->flags |= ((keyinfo->flags & HA_NOSAME) && From 4ef431ad55131e55b561728881061c266ef8d90a Mon Sep 17 00:00:00 2001 From: "igor@rurik.mysql.com" <> Date: Thu, 10 Feb 2005 23:47:57 -0800 Subject: [PATCH 12/22] select.result: Adjusted results of the test case for bug #7520 for 4.1. --- mysql-test/r/select.result | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 607cd11f089..70ac33964ad 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2392,11 +2392,11 @@ CREATE TABLE t2 ( a BLOB, INDEX (a(20)) ); INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five'); INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a; -table type possible_keys key key_len ref rows Extra -t1 ALL NULL NULL NULL NULL 5 -t2 ref a a 23 t1.a 5 +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 ref a a 23 test.t1.a 2 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; -table type possible_keys key key_len ref rows Extra -t1 ALL NULL NULL NULL NULL 5 -t2 ref a a 23 t1.a 5 +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 ref a a 23 test.t1.a 2 DROP TABLE t1, t2; From 634424ca1601e943cb7692dae3bbda743c10e07a Mon Sep 17 00:00:00 2001 From: "igor@rurik.mysql.com" <> Date: Fri, 11 Feb 2005 10:39:26 -0800 Subject: [PATCH 13/22] select.result: After revision of the fix for bug #7520. table.cc: Revised the fix for bug #7520. Made it compliant with 5.0 code where the bug does not exist. --- mysql-test/r/select.result | 2 +- sql/table.cc | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 4c6ad1c34f0..17897b2f549 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2371,7 +2371,7 @@ INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a; table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 5 -t2 ref a a 23 t1.a 5 +t2 ALL a NULL NULL NULL 4 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 5 diff --git a/sql/table.cc b/sql/table.cc index 244c7fa94f3..43ac122c7f3 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -143,7 +143,6 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, goto err_not_open; /* purecov: inspected */ bzero((char*) keyinfo,n_length); outparam->key_info=keyinfo; - outparam->max_key_length= outparam->total_key_length= 0; key_part= my_reinterpret_cast(KEY_PART_INFO*) (keyinfo+keys); strpos=disk_buff+6; @@ -199,11 +198,6 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, } key_part->store_length=key_part->length; } - set_if_bigger(outparam->max_key_length,keyinfo->key_length+ - keyinfo->key_parts); - outparam->total_key_length+= keyinfo->key_length; - if (keyinfo->flags & HA_NOSAME) - set_if_bigger(outparam->max_unique_length,keyinfo->key_length); } keynames=(char*) key_part; strpos+= (strmov(keynames, (char *) strpos) - keynames)+1; @@ -486,7 +480,6 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, if (!(field->flags & BINARY_FLAG)) keyinfo->flags|= HA_END_SPACE_KEY; } - set_if_bigger(outparam->max_key_length, keyinfo->key_length); if (i == 0 && key != primary_key) field->flags |= ((keyinfo->flags & HA_NOSAME) && @@ -547,6 +540,12 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, } } keyinfo->usable_key_parts=usable_parts; // Filesort + + set_if_bigger(outparam->max_key_length,keyinfo->key_length+ + keyinfo->key_parts); + outparam->total_key_length+= keyinfo->key_length; + if (keyinfo->flags & HA_NOSAME) + set_if_bigger(outparam->max_unique_length,keyinfo->key_length); } if (primary_key < MAX_KEY && (outparam->keys_in_use & ((key_map) 1 << primary_key))) From 8f95f5a59527bf5330c378f05e6a54b0427edfa5 Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Fri, 11 Feb 2005 21:57:37 +0200 Subject: [PATCH 14/22] Fixed mistyping (thnx to Konstantin) --- sql/sql_cache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index f503a63e752..d729a6cc301 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1337,7 +1337,7 @@ ulong Query_cache::init_cache() init(); approx_additional_data_size = (sizeof(Query_cache) + sizeof(gptr)*(def_query_hash_size+ - def_query_hash_size)); + def_table_hash_size)); if (query_cache_size < approx_additional_data_size) goto err; From 1bb04b064235fab13dd1c6ad58479005ef044979 Mon Sep 17 00:00:00 2001 From: "igor@rurik.mysql.com" <> Date: Fri, 11 Feb 2005 13:44:54 -0800 Subject: [PATCH 15/22] distinct.result: Adjustment of the result file after the revision of the fix for bug #7520. --- mysql-test/r/distinct.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index a0343f13394..d37c1e518fa 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -190,7 +190,7 @@ insert into t3 select * from t4; explain select distinct t1.a from t1,t3 where t1.a=t3.a; table type possible_keys key key_len ref rows Extra t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary -t3 ref a a 5 t1.a 10 Using where; Using index; Distinct +t3 ref a a 5 t1.a 12 Using where; Using index; Distinct select distinct t1.a from t1,t3 where t1.a=t3.a; a 1 From d355174522495ad94bbb8755ee32bf4163555579 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Sat, 12 Feb 2005 00:05:13 +0100 Subject: [PATCH 16/22] make LOAD INDEX to work --- myisam/mi_preload.c | 8 ++++---- mysql-test/r/preload.result | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/myisam/mi_preload.c b/myisam/mi_preload.c index 5e03d489efe..317ab4ad7fe 100644 --- a/myisam/mi_preload.c +++ b/myisam/mi_preload.c @@ -71,15 +71,15 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) if (flush_key_blocks(share->key_cache,share->kfile, FLUSH_RELEASE)) goto err; - + do { /* Read the next block of index file into the preload buffer */ if ((my_off_t) length > (key_file_length-pos)) length= (ulong) (key_file_length-pos); - if (my_pread(share->kfile, (byte*) buff, length, pos, MYF(MY_FAE))) + if (my_pread(share->kfile, (byte*) buff, length, pos, MYF(MY_FAE|MY_FNABP))) goto err; - + if (ignore_leaves) { uchar *end= buff+length; @@ -88,7 +88,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) if (mi_test_if_nod(buff)) { if (key_cache_insert(share->key_cache, - share->kfile, pos, DFLT_INIT_HITS, + share->kfile, pos, DFLT_INIT_HITS, (byte*) buff, block_length)) goto err; } diff --git a/mysql-test/r/preload.result b/mysql-test/r/preload.result index f0b99a8d6f1..7237a0da7e0 100644 --- a/mysql-test/r/preload.result +++ b/mysql-test/r/preload.result @@ -74,15 +74,15 @@ Table Op Msg_type Msg_text test.t1 preload_keys status OK show status like "key_read%"; Variable_name Value -Key_read_requests 0 -Key_reads 0 +Key_read_requests 581 +Key_reads 581 select count(*) from t1 where b = 'test1'; count(*) 4181 show status like "key_read%"; Variable_name Value -Key_read_requests 217 -Key_reads 45 +Key_read_requests 798 +Key_reads 581 flush tables; flush status; show status like "key_read%"; @@ -98,15 +98,15 @@ Table Op Msg_type Msg_text test.t1 preload_keys status OK show status like "key_read%"; Variable_name Value -Key_read_requests 0 -Key_reads 0 +Key_read_requests 10 +Key_reads 10 select count(*) from t1 where b = 'test1'; count(*) 4181 show status like "key_read%"; Variable_name Value -Key_read_requests 217 -Key_reads 45 +Key_read_requests 227 +Key_reads 52 flush tables; flush status; show status like "key_read%"; @@ -123,8 +123,8 @@ test.t1 preload_keys status OK test.t2 preload_keys status OK show status like "key_read%"; Variable_name Value -Key_read_requests 0 -Key_reads 0 +Key_read_requests 587 +Key_reads 587 select count(*) from t1 where b = 'test1'; count(*) 4181 @@ -133,8 +133,8 @@ count(*) 2584 show status like "key_read%"; Variable_name Value -Key_read_requests 351 -Key_reads 73 +Key_read_requests 938 +Key_reads 613 flush tables; flush status; show status like "key_read%"; @@ -147,8 +147,8 @@ test.t3 preload_keys error Table 'test.t3' doesn't exist test.t2 preload_keys status OK show status like "key_read%"; Variable_name Value -Key_read_requests 0 -Key_reads 0 +Key_read_requests 355 +Key_reads 355 flush tables; flush status; show status like "key_read%"; From 9ba7392306e939f804c6647cd94b32de030cdc2d Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Sat, 12 Feb 2005 16:27:22 +0400 Subject: [PATCH 17/22] Bug#8235 Connection collation change & table create with default result in crash --- mysql-test/r/ctype_ucs.result | 14 ++++++++++++++ mysql-test/t/ctype_ucs.test | 21 +++++++++++++++++++++ sql/field.cc | 12 ++++++++++-- strings/ctype-ucs2.c | 25 ++++++++++++++++++++++++- 4 files changed, 69 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 3f50d9dfa1b..0807cfabf2a 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -613,3 +613,17 @@ ucs2_bin 00610009 ucs2_bin 0061 ucs2_bin 00610020 drop table t1; +SET NAMES latin1; +SET collation_connection='ucs2_swedish_ci'; +CREATE TABLE t1 (Field1 int(10) default '0'); +INSERT INTO t1 VALUES ('-1'); +SELECT * FROM t1; +Field1 +-1 +DROP TABLE t1; +CREATE TABLE t1 (Field1 int(10) unsigned default '0'); +INSERT INTO t1 VALUES ('-1'); +Warnings: +Warning 1265 Data truncated for column 'Field1' at row 1 +DROP TABLE t1; +SET NAMES latin1; diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 1a0ba82d6ff..38956e12a3b 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -390,3 +390,24 @@ SET collation_connection='ucs2_general_ci'; SET NAMES latin1; SET collation_connection='ucs2_bin'; -- source include/ctype_filesort.inc + +SET NAMES latin1; +# +# Bug#8235 +# +# This bug also helped to find another problem that +# INSERT of a UCS2 string containing a negative number +# into a unsigned int column didn't produce warnings. +# This test covers both problems. +# +SET collation_connection='ucs2_swedish_ci'; +CREATE TABLE t1 (Field1 int(10) default '0'); +# no warnings, negative numbers are allowed +INSERT INTO t1 VALUES ('-1'); +SELECT * FROM t1; +DROP TABLE t1; +CREATE TABLE t1 (Field1 int(10) unsigned default '0'); +# this should generate a "Data truncated" warning +INSERT INTO t1 VALUES ('-1'); +DROP TABLE t1; +SET NAMES latin1; diff --git a/sql/field.cc b/sql/field.cc index e2f75034e52..fa0e202d513 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1777,6 +1777,14 @@ void Field_medium::sql_type(String &res) const ****************************************************************************/ +static bool test_if_minus(CHARSET_INFO *cs, + const char *s, const char *e) +{ + my_wc_t wc; + return cs->cset->mb_wc(cs, &wc, (uchar*) s, (uchar*) e) > 0 && wc == '-'; +} + + int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) { long tmp; @@ -1790,7 +1798,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) if (unsigned_flag) { - if (!len || *from == '-') + if (!len || test_if_minus(cs, from, from + len)) { tmp=0; // Set negative to 0 my_errno=ERANGE; @@ -2086,7 +2094,7 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs) my_errno=0; if (unsigned_flag) { - if (!len || *from == '-') + if (!len || test_if_minus(cs, from, from + len)) { tmp=0; // Set negative to 0 my_errno= ERANGE; diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index ea11f8816a5..e92704b83d7 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1480,6 +1480,29 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs, return 0; } + +ulong my_scan_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *str, const char *end, int sequence_type) +{ + const char *str0= str; + end--; /* for easier loop condition, because of two bytes per character */ + + switch (sequence_type) + { + case MY_SEQ_SPACES: + for ( ; str < end; str+= 2) + { + if (str[0] != '\0' || str[1] != ' ') + break; + } + return str - str0; + default: + return 0; + } +} + + + static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler = { NULL, /* init */ @@ -1534,7 +1557,7 @@ MY_CHARSET_HANDLER my_charset_ucs2_handler= my_strntoull_ucs2, my_strntod_ucs2, my_strtoll10_ucs2, - my_scan_8bit + my_scan_ucs2 }; From 56ea00afbd1258a3a966a3a32db79c78735ec3d1 Mon Sep 17 00:00:00 2001 From: "hf@deer.(none)" <> Date: Sat, 12 Feb 2005 20:09:40 +0400 Subject: [PATCH 18/22] Fix for bug #8477 (Embedded query_cache test crashes) --- libmysqld/emb_qcache.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libmysqld/emb_qcache.cc b/libmysqld/emb_qcache.cc index 7d83023abd5..2d3d82b7952 100644 --- a/libmysqld/emb_qcache.cc +++ b/libmysqld/emb_qcache.cc @@ -71,9 +71,11 @@ void Querycache_stream::store_int(uint i) cur_data+= 4; return; } - memcpy(cur_data, &i, rest_len); + char buf[4]; + int4store(buf, i); + memcpy(cur_data, buf, rest_len); use_next_block(); - memcpy(cur_data, ((byte*)&i)+rest_len, 4-rest_len); + memcpy(cur_data, buf+rest_len, 4-rest_len); cur_data+= 4-rest_len; } @@ -186,10 +188,12 @@ uint Querycache_stream::load_int() cur_data+= 4; return result; } - memcpy(&result, cur_data, rest_len); + char buf[4]; + memcpy(buf, cur_data, rest_len); use_next_block(); - memcpy(((byte*)&result)+rest_len, cur_data, 4-rest_len); + memcpy(buf+rest_len, cur_data, 4-rest_len); cur_data+= 4-rest_len; + result= uint4korr(buf); return result; } @@ -270,10 +274,10 @@ int Querycache_stream::load_column(MEM_ROOT *alloc, char** column) return 0; } len--; - if (!(*column= (char *)alloc_root(alloc, len + 4 + 1))) + if (!(*column= (char *)alloc_root(alloc, len + sizeof(uint) + 1))) return 1; - int4store(*column, len); - (*column)+= 4; + *((uint*)*column)= len; + (*column)+= sizeof(uint); load_str_only(*column, len); return 1; } From 40a2e968f9f993a945a0c324de0af3a40568a8ae Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Sat, 12 Feb 2005 19:17:33 +0100 Subject: [PATCH 19/22] new static archive_inited variable, so that archive_db_end() will do something only if archive_db_init() was run before (protection against destroying uninited mutex in the case where mysqld fails early at startup (before archive_db_init() was called) and then calls archive_db_end() to clean up). --- sql/examples/ha_archive.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc index 491056d0e59..bc4af0c7dc7 100644 --- a/sql/examples/ha_archive.cc +++ b/sql/examples/ha_archive.cc @@ -114,6 +114,8 @@ data - The data is stored in a "row +blobs" format. */ +/* If the archive storage engine has been inited */ +static bool archive_inited= 0; /* Variables for archive share methods */ pthread_mutex_t archive_mutex; static HASH archive_open_tables; @@ -157,6 +159,7 @@ static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length, bool archive_db_init() { + archive_inited= 1; VOID(pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST)); return (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0, (hash_get_key) archive_get_key, 0, 0)); @@ -176,8 +179,12 @@ bool archive_db_init() bool archive_db_end() { - hash_free(&archive_open_tables); - VOID(pthread_mutex_destroy(&archive_mutex)); + if (archive_inited) + { + hash_free(&archive_open_tables); + VOID(pthread_mutex_destroy(&archive_mutex)); + } + archive_inited= 0; return FALSE; } From 548f7dbada385ca42b78cc6c32639174464a0800 Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Sun, 13 Feb 2005 21:00:07 +0200 Subject: [PATCH 20/22] row0mysql.c: Backport the column prefix memory corruption fix from 5.0 --- innobase/row/row0mysql.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 1ab7bb1deb0..a915200161f 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -399,7 +399,7 @@ row_create_prebuilt( prebuilt->sel_graph = NULL; prebuilt->search_tuple = dtuple_create(heap, - dict_table_get_n_cols(table)); + 2 * dict_table_get_n_cols(table)); clust_index = dict_table_get_first_index(table); From 4957c4850d34dfd3b66d7e8c130e321d33bf15ab Mon Sep 17 00:00:00 2001 From: "acurtis@pcgem.rdg.cyberkinetica.com" <> Date: Sun, 13 Feb 2005 22:35:52 +0000 Subject: [PATCH 21/22] Bug#2435 Alter handling for UNION syntax Tests for UNION and parentheses --- mysql-test/r/union.result | 22 ++++++++++++++++++++++ mysql-test/t/union.test | 12 ++++++++++++ sql/sql_yacc.yy | 35 ++++++++++++++++++++++++++++------- 3 files changed, 62 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 115ef6a47f9..f58f0f5b0ac 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1173,3 +1173,25 @@ show columns from t4; Field Type Null Key Default Extra sdate date YES NULL drop table t1, t2, t3, t4; +create table t1 (a int not null, b char (10) not null); +insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); +select * from ((select * from t1 limit 1)) a; +a b +1 a +select * from ((select * from t1 limit 1) union (select * from t1 limit 1)) a; +a b +1 a +select * from ((select * from t1 limit 1) union (select * from t1 limit 1) union (select * from t1 limit 1)) a; +a b +1 a +select * from ((((select * from t1))) union (select * from t1) union (select * from t1)) a; +a b +1 a +2 b +3 c +select * from ((select * from t1) union (((select * from t1))) union (select * from t1)) a; +a b +1 a +2 b +3 c +drop table t1; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 90b2197603b..82f26f63254 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -699,3 +699,15 @@ union order by sdate; show columns from t4; drop table t1, t2, t3, t4; + +# +# Bug #2435 UNION with parentheses not supported +# +create table t1 (a int not null, b char (10) not null); +insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); +select * from ((select * from t1 limit 1)) a; +select * from ((select * from t1 limit 1) union (select * from t1 limit 1)) a; +select * from ((select * from t1 limit 1) union (select * from t1 limit 1) union (select * from t1 limit 1)) a; +select * from ((((select * from t1))) union (select * from t1) union (select * from t1)) a; +select * from ((select * from t1) union (((select * from t1))) union (select * from t1)) a; +drop table t1; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index e70efe14557..988323811ac 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2389,7 +2389,10 @@ select: select_init: SELECT_SYM select_init2 | - '(' SELECT_SYM select_part2 ')' + '(' select_paren ')' union_opt; + +select_paren: + SELECT_SYM select_part2 { LEX *lex= Lex; SELECT_LEX * sel= lex->current_select; @@ -2408,7 +2411,8 @@ select_init: if (sel->master_unit()->fake_select_lex) sel->master_unit()->global_parameters= sel->master_unit()->fake_select_lex; - } union_opt; + } + | '(' select_paren ')'; select_init2: select_part2 @@ -3404,8 +3408,7 @@ when_list2: }; join_table_list: - '(' join_table_list ')' { $$=$2; } - | join_table { $$=$1; } + join_table { $$=$1; } | join_table_list ',' join_table_list { $$=$3; } | join_table_list normal_join join_table_list { $$=$3; } | join_table_list STRAIGHT_JOIN join_table_list @@ -3482,7 +3485,7 @@ join_table: } | '{' ident join_table LEFT OUTER JOIN_SYM join_table ON expr '}' { add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; } - | '(' SELECT_SYM select_derived ')' opt_table_alias + | '(' select_derived union_opt ')' opt_table_alias { LEX *lex=Lex; SELECT_LEX_UNIT *unit= lex->current_select->master_unit(); @@ -3493,9 +3496,27 @@ join_table: (List *)0))) YYABORT; - }; + } + | '(' join_table_list ')' { $$=$2; }; select_derived: + SELECT_SYM select_derived2 + | '(' select_derived ')' + { + LEX *lex= Lex; + SELECT_LEX * sel= lex->current_select; + if (sel->set_braces(1)) + { + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; + } + /* select in braces, can't contain global parameters */ + if (sel->master_unit()->fake_select_lex) + sel->master_unit()->global_parameters= + sel->master_unit()->fake_select_lex; + }; + +select_derived2: { LEX *lex= Lex; lex->derived_tables= 1; @@ -3517,7 +3538,7 @@ select_derived: { Select->parsing_place= NO_MATTER; } - opt_select_from union_opt + opt_select_from ; opt_outer: From 10c53ae1e5295c46f240d890e13b56f483708fee Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Mon, 14 Feb 2005 11:14:04 +0100 Subject: [PATCH 22/22] remove passwordless remote accounts from windows distro --- scripts/mysql_create_system_tables.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh index f524b322388..83fdc0639ce 100644 --- a/scripts/mysql_create_system_tables.sh +++ b/scripts/mysql_create_system_tables.sh @@ -163,9 +163,7 @@ then INSERT INTO user (host,user) values ('localhost','');" else i_u="$i_u - INSERT INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); - INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); - INSERT INTO user VALUES ('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0);" + INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);" fi fi fi