From b1e28b5491d4be58d8a34a187219b774f8511d2a Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Mon, 10 Mar 2003 17:14:01 +0200 Subject: [PATCH 01/10] A fix for an obvious bug in hash generating proram. --- sql/gen_lex_hash.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index f94d8dddb59..2be57a49a99 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -274,7 +274,7 @@ void print_arrays() function_plus,function_mod); int *prva= (int*) my_alloca(sizeof(int)*function_mod); - for (i=0 ; i <= function_mod; i++) + for (i=0 ; i < function_mod; i++) prva[i]= max_symbol; for (i=0;i Date: Tue, 11 Mar 2003 15:37:31 +0100 Subject: [PATCH 02/10] - fixed C++-style comments in .c files to make IBM compiler happy (it barfs on these with a syntax error) --- sql/net_serv.cc | 2 +- strings/ctype-tis620.c | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sql/net_serv.cc b/sql/net_serv.cc index c6a0b8c5b3e..c8c774d365f 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -181,7 +181,7 @@ static my_bool net_realloc(NET *net, ulong length) void net_clear(NET *net) { #ifndef EXTRA_DEBUG - int count; // One may get 'unused' warning + int count; /* One may get 'unused' warning */ bool is_blocking=vio_is_blocking(net->vio); if (is_blocking) vio_blocking(net->vio, FALSE); diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index 1c0acc38e24..c39930179cf 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -444,8 +444,8 @@ static uchar* thai2sortable(const uchar * tstr,uint len) const uchar* p = tstr; uchar *outBuf; -// uchar *pRight1, *pRight2, *pRight3, *pRight4; -// uchar *pLeft1, *pLeft2, *pLeft3, *pLeft4; +/* uchar *pRight1, *pRight2, *pRight3, *pRight4; */ +/* uchar *pLeft1, *pLeft2, *pLeft3, *pLeft4; */ uchar *pRight1, *pRight2, *pRight3; uchar *pLeft1, *pLeft2, *pLeft3; uint bufSize; @@ -480,11 +480,11 @@ static uchar* thai2sortable(const uchar * tstr,uint len) *pRight1++ = t_ctype[p[1]][0]; *pRight2++ = t_ctype[p[1]][1]; *pRight3++ = t_ctype[p[1]][2]; -// *pRight4++ = t_ctype[p[1]][3]; +/* *pRight4++ = t_ctype[p[1]][3]; */ *pRight1++ = t_ctype[*p][0]; *pRight2++ = t_ctype[*p][1]; *pRight3++ = t_ctype[*p][2]; -// *pRight4++ = t_ctype[*p][3]; +/* *pRight4++ = t_ctype[*p][3]; */ len--; p += 2; } else { @@ -501,17 +501,17 @@ static uchar* thai2sortable(const uchar * tstr,uint len) } *pRight1++ = L2_BLANK; *pRight2++ = L3_BLANK; -// *pRight3++ = L4_BLANK; +/* *pRight3++ = L4_BLANK; */ *pRight3++ = '\0'; -// *pRight4++ = '\0'; +/* *pRight4++ = '\0'; */ memcpy(pRight1, pLeft2, pRight2 - pLeft2); pRight1 += pRight2 - pLeft2; memcpy(pRight1, pLeft3, pRight3 - pLeft3); -// pRight1 += pRight3 - pLeft3; -// memcpy(pRight1, pLeft4, pRight4 - pLeft4); +/* pRight1 += pRight3 - pLeft3; */ +/* memcpy(pRight1, pLeft4, pRight4 - pLeft4); */ free(pLeft2); free(pLeft3); -// free(pLeft4); +/* free(pLeft4); */ return(outBuf); } @@ -603,22 +603,22 @@ my_bool my_like_range_tis620(const char *ptr, uint ptr_length, pchar escape, { if (*ptr == escape && ptr+1 != end) { - ptr++; // Skipp escape + ptr++; /* Skipp escape */ *min_str++= *max_str++ = *ptr; continue; } - if (*ptr == wild_one) // '_' in SQL + if (*ptr == wild_one) /* '_' in SQL */ { - *min_str++='\0'; // This should be min char + *min_str++='\0'; /* This should be min char */ *max_str++=max_sort_chr; continue; } - if (*ptr == wild_many) // '%' in SQL + if (*ptr == wild_many) /* '%' in SQL */ { *min_length= (uint) (min_str - min_org); *max_length=res_length; do { - *min_str++ = ' '; // Because if key compression + *min_str++ = ' '; /* Because if key compression */ *max_str++ = max_sort_chr; } while (min_str != min_end); return 0; @@ -628,7 +628,7 @@ my_bool my_like_range_tis620(const char *ptr, uint ptr_length, pchar escape, *min_length= *max_length = (uint) (min_str - min_org); while (min_str != min_end) - *min_str++ = *max_str++ = ' '; // Because if key compression + *min_str++ = *max_str++ = ' '; /* Because if key compression */ return 0; } From b283e08cf3ac0d4fabb7e329a2e7cbe93056a04e Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Tue, 11 Mar 2003 18:34:00 +0200 Subject: [PATCH 03/10] fixed bug of unchecked random part of WHERE clause (bug #142) --- mysql-test/r/select.result | 1 + mysql-test/t/select.test | 17 ++++++++++++++++- sql/sql_select.cc | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 5ac5de05f97..dcb796b8e00 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -1793,3 +1793,4 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par t2 0 PRIMARY 1 auto A 1199 NULL NULL t2 0 fld1 1 fld1 A 1199 NULL NULL t2 1 fld3 1 fld3 A NULL NULL NULL +1 diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index cdb6ee57e0f..2caadd99dbb 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -1712,8 +1712,23 @@ show full columns from t2 from test like 'f%'; show full columns from t2 from test like 's%'; show keys from t2; +# +# random in WHERE clause +# + +drop table t1; +CREATE TABLE t1 ( + id mediumint(8) unsigned NOT NULL auto_increment, + pseudo varchar(35) NOT NULL default '', + PRIMARY KEY (id), + UNIQUE KEY pseudo (pseudo) +); +INSERT INTO t1 (pseudo) VALUES ('test'); +INSERT INTO t1 (pseudo) VALUES ('test1'); +SELECT 1 from t1 where rand() > 2; + # # Drop the test tables # -drop table t4, t3,t2, t1; +drop table t4, t3, t2, t1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8444a451965..bae64969fcd 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2257,6 +2257,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) { JOIN_TAB *tab=join->join_tab+i; table_map current_map= tab->table->map; + if (i == join->tables-1) + current_map|= RAND_TABLE_BIT; bool use_quick_range=0; used_tables|=current_map; From b69e0f48bee5ec65fe6d069120c579c41b5c0cc2 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Tue, 11 Mar 2003 18:54:57 +0100 Subject: [PATCH 04/10] - made test for multiple --user options more sh-compatible --- scripts/safe_mysqld.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/safe_mysqld.sh b/scripts/safe_mysqld.sh index a8ca3537cb3..6b7e16c57b0 100644 --- a/scripts/safe_mysqld.sh +++ b/scripts/safe_mysqld.sh @@ -34,8 +34,8 @@ parse_arguments() { --datadir=*) DATADIR=`echo "$arg" | sed -e "s;--[^=]*=;;"` ;; --pid-file=*) pid_file=`echo "$arg" | sed -e "s;--[^=]*=;;"` ;; --user=*) - if [ $SET_USER == 0 ] - then + if test $SET_USER -eq 0 + then user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1 fi ;; From 77dd897ead99cdd65cc2bd77fe17ab3c17fdb7a3 Mon Sep 17 00:00:00 2001 From: "serg@serg.mysql.com" <> Date: Tue, 11 Mar 2003 21:20:53 +0100 Subject: [PATCH 05/10] fixed an obscure bug in group by + having + Item_ref::get_date --- mysql-test/r/group_by.result | 1 + mysql-test/t/group_by.test | 8 ++++++++ sql/item.cc | 11 +++++++++++ sql/item.h | 11 +++++++---- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 113f8325685..0073827056d 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -128,3 +128,4 @@ a MAX(b) ELT(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f') a MAX(b) MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h') 1 4 c 10 43 a,b,d,f +a c count(distinct rand()) diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 6e256d7896f..20e11713d31 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -346,3 +346,11 @@ select a, MAX(b), CONCAT_WS(MAX(b), '43', '4', '5') from t1 group by a; select a, MAX(b), ELT(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f') from t1 group by a; select a, MAX(b), MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h') from t1 group by a; drop table t1; + +# not purely group_by bug, but group_by is involved... + +create table t1 (a date default null, b date default null); +insert t1 values ('1999-10-01','2000-01-10'), ('1997-01-01','1998-10-01'); +select a,min(b) c,count(distinct rand()) from t1 group by a having cis_null()) || + result_field->get_date(ltime,fuzzydate)) + { + bzero((char*) ltime,sizeof(*ltime)); + return 1; + } + return 0; +} + bool Item_field::get_time(TIME *ltime) { if ((null_value=field->is_null()) || field->get_time(ltime)) diff --git a/sql/item.h b/sql/item.h index 408010d211a..3cf5a17805c 100644 --- a/sql/item.h +++ b/sql/item.h @@ -82,6 +82,8 @@ public: virtual void split_sum_func(List &fields) {} virtual bool get_date(TIME *ltime,bool fuzzydate); virtual bool get_time(TIME *ltime); + virtual bool get_date_result(TIME *ltime,bool fuzzydate) + { return get_date(ltime,fuzzydate); } }; @@ -129,8 +131,9 @@ public: return field->result_type(); } Field *tmp_table_field() { return result_field; } - bool get_date(TIME *ltime,bool fuzzydate); - bool get_time(TIME *ltime); + bool get_date(TIME *ltime,bool fuzzydate); + bool get_date_result(TIME *ltime,bool fuzzydate); + bool get_time(TIME *ltime); }; @@ -332,8 +335,8 @@ public: return tmp; } bool get_date(TIME *ltime,bool fuzzydate) - { - return (null_value=(*ref)->get_date(ltime,fuzzydate)); + { + return (null_value=(*ref)->get_date_result(ltime,fuzzydate)); } bool send(String *tmp) { return (*ref)->send(tmp); } void make_field(Send_field *field) { (*ref)->make_field(field); } From f8fa73d75bac9a151340607829a6bb710aeef8cf Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Tue, 11 Mar 2003 22:47:29 +0100 Subject: [PATCH 06/10] - Fixed man page for apropos/whatis (thanks to Christian Hammers from Debian for the patch) (bug #135) --- man/perror.1 | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/man/perror.1 b/man/perror.1 index bd5a4211f4b..eb6c9f39d56 100755 --- a/man/perror.1 +++ b/man/perror.1 @@ -1,17 +1,12 @@ .TH perror 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME -.BR perror -can be used to display a description for a system error code, or an MyISAM/ISAM table handler error code. The error messages are mostly system dependent. -.SH USAGE -perror [OPTIONS] [ERRORCODE [ERRORCODE...]] +perror \- describes a system or MySQL error code. .SH SYNOPSIS -.B perror -.RB [ \-? | \-\-help ] -.RB [ \-I | \-\-info ] -.RB [ \-s | \-\-silent ] -.RB [ \-v | \-\-verbose ] -.RB [ \-V | \-\-version ] +perror [OPTIONS] [ERRORCODE [ERRORCODE...]] .SH DESCRIPTION +Can be used to display a description for a system error code, or an MyISAM/ISAM table handler error code. +The error messages are mostly system dependent. +.SH OPTIONS .TP .BR \-? | \-\-help Displays this help and exits. From 88f811c8a5bfcf03401928f51fa28978a9401835 Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Wed, 12 Mar 2003 16:43:01 +0200 Subject: [PATCH 07/10] NEWDATE -> DATE in anylyse() output Changed that analyse(#) also affects strings --- mysql-test/r/analyse.result | 12 ++++++ mysql-test/t/analyse.test | 5 ++- sql/sql_analyse.cc | 80 ++++++++++++++++++++++--------------- 3 files changed, 63 insertions(+), 34 deletions(-) diff --git a/mysql-test/r/analyse.result b/mysql-test/r/analyse.result index f6b8cc2fcbf..e69a7e99992 100644 --- a/mysql-test/r/analyse.result +++ b/mysql-test/r/analyse.result @@ -1,6 +1,18 @@ Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL +t1.empty_string 0 0 4 0 0.0000 NULL ENUM('') NOT NULL +t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL +t1.d 2002-03-04 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL +Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype +t1.i 1 7 1 1 0 0 4.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL +t1.j 2 8 1 1 0 0 5.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL +t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL +t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL +t1.d 2002-03-04 10 10 0 0 10.0000 NULL DATE NOT NULL Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL +t1.empty_string 0 0 4 0 0.0000 NULL ENUM('') NOT NULL +t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL +t1.d 2002-03-04 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL diff --git a/mysql-test/t/analyse.test b/mysql-test/t/analyse.test index 1b5022f6e4c..a937318aa6c 100644 --- a/mysql-test/t/analyse.test +++ b/mysql-test/t/analyse.test @@ -2,9 +2,10 @@ # Test of procedure analyse # -create table t1 (i int, j int); -insert into t1 values (1,2), (3,4), (5,6), (7,8); +create table t1 (i int, j int, empty_string char(10), bool char(1), d date); +insert into t1 values (1,2,"","Y","2002-03-03"), (3,4,"","N","2002-03-04"), (5,6,"","Y","2002-03-04"), (7,8,"","N","2002-03-05"); select * from t1 procedure analyse(); +select * from t1 procedure analyse(2); create table t2 select * from t1 procedure analyse(); select * from t2; drop table t1,t2; diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 6227b1251db..80a35120f45 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -122,12 +122,15 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result, *f_info++ = new field_str(item, pc); } return pc; -} // proc_analyse_init +} -// return 1 if number, else return 0 -// store info about found number in info -// NOTE:It is expected, that elements of 'info' are all zero! +/* + Return 1 if number, else return 0 + store info about found number in info + NOTE:It is expected, that elements of 'info' are all zero! +*/ + bool test_if_number(NUM_INFO *info, const char *str, uint str_len) { const char *begin, *end = str + str_len; @@ -205,14 +208,16 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len) } else return 0; -} //test_if_number +} -// Stores the biggest and the smallest value from current 'info' -// to ev_num_info -// If info contains an ulonglong number, which is bigger than -// biggest positive number able to be stored in a longlong variable -// and is marked as negative, function will return 0, else 1. +/* + Stores the biggest and the smallest value from current 'info' + to ev_num_info + If info contains an ulonglong number, which is bigger than + biggest positive number able to be stored in a longlong variable + and is marked as negative, function will return 0, else 1. +*/ bool get_ev_num_info(EV_NUM_INFO *ev_info, NUM_INFO *info, const char *num) { @@ -240,11 +245,13 @@ void free_string(String *s) s->free(); } + void field_str::add() { char buff[MAX_FIELD_WIDTH], *ptr; String s(buff, sizeof(buff)), *res; ulong length; + TREE_ELEMENT *element; if (!(res = item->val_str(&s))) { @@ -285,7 +292,7 @@ void field_str::add() if (!tree_search(&tree, (void*) &s)) // If not in tree { s.copy(); // slow, when SAFE_MALLOC is in use - if (!tree_insert(&tree, (void*) &s, 0)) + if (!(element=tree_insert(&tree, (void*) &s, 0))) { room_in_tree = 0; // Remove tree, out of RAM ? delete_tree(&tree); @@ -293,7 +300,9 @@ void field_str::add() else { bzero((char*) &s, sizeof(s)); // Let tree handle free of this - if ((treemem += length) > pc->max_treemem) + if ((treemem += length) > pc->max_treemem || + (element->count == 1 && + (tree_elements++) >= pc->max_tree_elements)) { room_in_tree = 0; // Remove tree, too big tree delete_tree(&tree); @@ -389,9 +398,11 @@ void field_real::add() room_in_tree = 0; // Remove tree, out of RAM ? delete_tree(&tree); } - // if element->count == 1, this element can be found only once from tree - // if element->count == 2, or more, this element is already in tree - else if (element->count == 1 && (tree_elements++) > pc->max_tree_elements) + /* + if element->count == 1, this element can be found only once from tree + if element->count == 2, or more, this element is already in tree + */ + else if (element->count == 1 && (tree_elements++) >= pc->max_tree_elements) { room_in_tree = 0; // Remove tree, too many elements delete_tree(&tree); @@ -420,6 +431,7 @@ void field_real::add() } } // field_real::add + void field_longlong::add() { char buff[MAX_FIELD_WIDTH]; @@ -442,9 +454,11 @@ void field_longlong::add() room_in_tree = 0; // Remove tree, out of RAM ? delete_tree(&tree); } - // if element->count == 1, this element can be found only once from tree - // if element->count == 2, or more, this element is already in tree - else if (element->count == 1 && (tree_elements++) > pc->max_tree_elements) + /* + if element->count == 1, this element can be found only once from tree + if element->count == 2, or more, this element is already in tree + */ + else if (element->count == 1 && (tree_elements++) >= pc->max_tree_elements) { room_in_tree = 0; // Remove tree, too many elements delete_tree(&tree); @@ -496,9 +510,11 @@ void field_ulonglong::add() room_in_tree = 0; // Remove tree, out of RAM ? delete_tree(&tree); } - // if element->count == 1, this element can be found only once from tree - // if element->count == 2, or more, this element is already in tree - else if (element->count == 1 && (tree_elements++) > pc->max_tree_elements) + /* + if element->count == 1, this element can be found only once from tree + if element->count == 2, or more, this element is already in tree + */ + else if (element->count == 1 && (tree_elements++) >= pc->max_tree_elements) { room_in_tree = 0; // Remove tree, too many elements delete_tree(&tree); @@ -578,14 +594,16 @@ bool analyse::end_of_records() func_items[8]->null_value = 1; else func_items[8]->set(res->ptr(), res->length()); - // count the dots, quotas, etc. in (ENUM("a","b","c"...)) - // if tree has been removed, don't suggest ENUM. - // treemem is used to measure the size of tree for strings, - // tree_elements is used to count the elements in tree in case of numbers. - // max_treemem tells how long the string starting from ENUM("... and - // ending to ..") shall at maximum be. If case is about numbers, - // max_tree_elements will tell the length of the above, now - // every number is considered as length 1 + /* + count the dots, quotas, etc. in (ENUM("a","b","c"...)) + If tree has been removed, don't suggest ENUM. + treemem is used to measure the size of tree for strings, + tree_elements is used to count the elements + max_treemem tells how long the string starting from ENUM("... and + ending to ..") shall at maximum be. If case is about numbers, + max_tree_elements will tell the length of the above, now + every number is considered as length 1 + */ if (((*f)->treemem || (*f)->tree_elements) && (*f)->tree.elements_in_tree && (((*f)->treemem ? max_treemem : max_tree_elements) > @@ -628,6 +646,7 @@ bool analyse::end_of_records() ans.append("DATETIME", 8); break; case FIELD_TYPE_DATE: + case FIELD_TYPE_NEWDATE: ans.append("DATE", 4); break; case FIELD_TYPE_SET: @@ -639,9 +658,6 @@ bool analyse::end_of_records() case FIELD_TYPE_TIME: ans.append("TIME", 4); break; - case FIELD_TYPE_NEWDATE: - ans.append("NEWDATE", 7); - break; case FIELD_TYPE_DECIMAL: ans.append("DECIMAL", 7); // if item is FIELD_ITEM, it _must_be_ Field_num in this case From d87036511b549ade0e77d4007952213d92ca0045 Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Wed, 12 Mar 2003 17:08:48 +0200 Subject: [PATCH 08/10] Fix for a bug with column privileges ... --- sql/sql_base.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index bab4c151ef3..1ed0673f4cf 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1616,7 +1616,7 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length, else thd->dupp_field=field; } - if (check_grants && !thd->master_access && check_grant_column(thd,table,name,length)) + if (check_grants && check_grant_column(thd,table,name,length)) return WRONG_GRANT; return field; } @@ -1643,7 +1643,8 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables) { found_table=1; Field *find=find_field_in_table(thd,tables->table,name,length, - grant_option && !thd->master_access,1); + grant_option && + tables->grant.want_privilege ,1); if (find) { if (find == WRONG_GRANT) @@ -1682,7 +1683,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables) for (; tables ; tables=tables->next) { Field *field=find_field_in_table(thd,tables->table,name,length, - grant_option && !thd->master_access, allow_rowid); + grant_option && tables->grant.want_privilege ,allow_rowid); if (field) { if (field == WRONG_GRANT) From b3c600cdbc95b0542ce66d9f42cf6f89401c3076 Mon Sep 17 00:00:00 2001 From: "serg@serg.mysql.com" <> Date: Wed, 12 Mar 2003 18:32:27 +0100 Subject: [PATCH 09/10] ha_myisam.cc: typo fixed --- sql/ha_myisam.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 1349e28b546..895558320fd 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -621,7 +621,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) the following 'if', thought conceptually wrong, is a useful optimization nevertheless. */ - if (file->state != &file->s->state.state); + if (file->state != &file->s->state.state) file->s->state.state = *file->state; if (file->s->base.auto_key) update_auto_increment_key(¶m, file, 1); From 91fc15fc6d4697a6701d0deca240a58411a19000 Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Wed, 12 Mar 2003 22:50:22 +0200 Subject: [PATCH 10/10] added comment --- sql/sql_select.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index bae64969fcd..cafafee243e 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2257,6 +2257,10 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) { JOIN_TAB *tab=join->join_tab+i; table_map current_map= tab->table->map; + /* + Following force including random expression in last table condition. + It solve problem with select like SELECT * FROM t1 WHERE rand() > 0.5 + */ if (i == join->tables-1) current_map|= RAND_TABLE_BIT; bool use_quick_range=0;