From 54fa39256ba81d421d23d4b7189a3c77bc68e7d0 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 29 Aug 2003 14:38:39 +0400 Subject: removed stale comment 13:58 konstantin: the comment is missplaced (probably after merge). You can remove it sql/sql_parse.cc: removed stale comment BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- sql/sql_parse.cc | 1 - 1 file changed, 1 deletion(-) (limited to 'sql') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d7d7469ceed..663567acfbd 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -533,7 +533,6 @@ check_connections(THD *thd) thd->ip= 0; bzero((char*) &thd->remote,sizeof(struct sockaddr)); } - /* Ensure that wrong hostnames doesn't cause buffer overflows */ vio_keepalive(net->vio, TRUE); ulong pkt_len=0; -- cgit v1.2.1 From 86da2cda60b4b8999b98aff1043a7eb1f5ba7ee7 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 1 Sep 2003 14:18:27 +0200 Subject: workaround for IN's special treatment of first argument. Not for 4.1 --- sql/sql_select.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sql') diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d48e809966c..153b083b3ef 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1556,7 +1556,13 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level, if (cond_func->key_item()->type() == Item::FIELD_ITEM) add_key_field(key_fields,*and_level, ((Item_field*) (cond_func->key_item()))->field, 0, +#ifndef TO_BE_REMOVED_IN_4_1 + /* special treatment for IN. Not necessary in 4.1 */ + cond_func->arguments() + (cond_func->functype() != Item_func::IN_FUNC), + cond_func->argument_count() - (cond_func->functype() != Item_func::IN_FUNC), +#else cond_func->arguments()+1, cond_func->argument_count()-1, +#endif usable_tables); break; case Item_func::OPTIMIZE_OP: -- cgit v1.2.1 From 92bb23e257412a84becb3a9b2800bc9b5fe19dc7 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 2 Sep 2003 11:18:13 +0200 Subject: bug #928 - arbitrary table grant was used, sort-order wasn't honored --- sql/sql_acl.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 554417322a4..56884ad9dd1 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1204,6 +1204,7 @@ class GRANT_TABLE :public Sql_alloc public: char *host,*db,*user,*tname, *hash_key; uint privs, cols, key_length; + ulong sort; HASH hash_columns; GRANT_TABLE (const char *h, const char *d,const char *u, const char *t, uint p,uint c) @@ -1212,6 +1213,7 @@ public: host = strdup_root(&memex,h); db = strdup_root(&memex,d); user = strdup_root(&memex,u); + sort= get_sort(3,host,db,user); tname= strdup_root(&memex,t); key_length =(uint) strlen(d)+(uint) strlen(u)+(uint) strlen(t)+3; hash_key = (char*) alloc_root(&memex,key_length); @@ -1227,6 +1229,7 @@ public: host = get_field(&memex,form,0); db = get_field(&memex,form,1); user = get_field(&memex,form,2); if (!user) user=(char*) ""; + sort= get_sort(3,host,db,user); tname = get_field(&memex,form,3); if (!host || !db || !tname) { @@ -1324,9 +1327,10 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip, } else { - if ((host && !wild_case_compare(host,grant_table->host)) || - (ip && !wild_case_compare(ip,grant_table->host))) - found=grant_table; // Host ok + if (((host && !wild_case_compare(host,grant_table->host)) || + (ip && !wild_case_compare(ip,grant_table->host))) && + (!found || found->sort < grant_table->sort)) + found=grant_table; } } return found; -- cgit v1.2.1 From e1af4a65dcfd53db807bf08fb4f06a465073cb57 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 2 Sep 2003 21:09:28 +0500 Subject: Fix for the bug #971: ORDER BY DESC doesn't return correct num of rows with BDB and an indexed column. --- sql/ha_berkeley.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql') diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 2154fbd7a32..78704a18052 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -1420,6 +1420,8 @@ int ha_berkeley::index_read(byte * buf, const byte * key, bzero((char*) &row,sizeof(row)); if (key_len == key_info->key_length) { + if (find_flag == HA_READ_AFTER_KEY) + key_info->handler.bdb_return_if_eq= 1; error=read_row(cursor->c_get(cursor, pack_key(&last_key, active_index, key_buff, @@ -1428,6 +1430,7 @@ int ha_berkeley::index_read(byte * buf, const byte * key, (find_flag == HA_READ_KEY_EXACT ? DB_SET : DB_SET_RANGE)), (char*) buf, active_index, &row, (DBT*) 0, 0); + key_info->handler.bdb_return_if_eq= 0; } else { -- cgit v1.2.1 From f0879fd9a765a996e28408671d957992d53142fd Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 3 Sep 2003 22:27:04 +0200 Subject: bug #1172 - crash on force index() and SEL_ARG::MAYBE_KEY --- sql/opt_range.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 5049700a67f..8dad80d3eba 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -692,7 +692,7 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables, uint keynr= param.real_keynr[idx]; if ((*key)->type == SEL_ARG::MAYBE_KEY || (*key)->maybe_flag) - needed_reg|= (key_map) 1 << keynr; + needed_reg|= (key_map) 1 << keynr; found_records=check_quick_select(¶m, idx, *key); if (found_records != HA_POS_ERROR && found_records > 2 && @@ -716,7 +716,7 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables, param.range_count, found_records)+ (double) found_records / TIME_FOR_COMPARE); - if (read_time > found_read_time) + if (read_time > found_read_time && found_records != HA_POS_ERROR) { read_time=found_read_time; records=found_records; -- cgit v1.2.1 From ad66d486f00aa1382c36dfd151b37f7ea683314e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Sep 2003 11:42:21 +0200 Subject: bug#926 fix undone - it caused suboptimal execution plan for "range ON, no WHERE" query Another fix applied --- sql/sql_select.cc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 153b083b3ef..6f6d21f1f8b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -146,7 +146,7 @@ static void copy_sum_funcs(Item_sum **func_ptr); static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab); static void init_sum_functions(Item_sum **func); static bool update_sum_func(Item_sum **func); -static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, +static void select_describe(JOIN *join, bool need_tmp_table,bool need_order, bool distinct, const char *message=NullS); static void describe_info(JOIN *join, const char *info); @@ -2663,13 +2663,30 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) join->thd->select_limit < join->best_positions[i].records_read && !(join->select_options & OPTION_FOUND_ROWS))) { + /* Join with outer join condition */ + COND *orig_cond=sel->cond; + sel->cond=and_conds(sel->cond,tab->on_expr); if (sel->test_quick_select(tab->keys, used_tables & ~ current_map, (join->select_options & OPTION_FOUND_ROWS ? HA_POS_ERROR : join->thd->select_limit)) < 0) - DBUG_RETURN(1); // Impossible range + { /* before reporting "Impossible WHERE" for the whole query + we have to check isn't it only "impossible ON" instead */ + sel->cond=orig_cond; + if (!tab->on_expr || + sel->test_quick_select(tab->keys, + used_tables & ~ current_map, + (join->select_options & + OPTION_FOUND_ROWS ? + HA_POS_ERROR : + join->thd->select_limit)) < 0) + DBUG_RETURN(1); // Impossible WHERE + } + else + sel->cond=orig_cond; + /* Fix for EXPLAIN */ if (sel->quick) join->best_positions[i].records_read= sel->quick->records; -- cgit v1.2.1 From a65f5081ba3b326b06f9cece549d7e2e319d8aba Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Sep 2003 14:44:21 +0200 Subject: Add QUICK as mysql-recover option in mysqld --help BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 10d7955f13b..bcf115feccc 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3492,7 +3492,7 @@ Does nothing yet.", (gptr*) &master_ssl_cipher, (gptr*) &master_ssl_capath, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"myisam-recover", OPT_MYISAM_RECOVER, - "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP or FORCE.", + "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.", (gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory, -- cgit v1.2.1 From 8aff7009fd50a6d0fc843a8d0342cbef53f4c839 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Sep 2003 14:46:44 +0500 Subject: fix for #1211 sql/sql_parse.cc: Replication's commands were allowed, but didn't have proper implementations for embedded library --- sql/sql_parse.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sql') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 663567acfbd..4482342f4ce 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1499,6 +1499,8 @@ mysql_execute_command(void) res = mysql_restore_table(thd, tables); break; } + +#ifndef EMBEDDED_LIBRARY case SQLCOM_CHANGE_MASTER: { if (check_global_access(thd, SUPER_ACL)) @@ -1535,6 +1537,8 @@ mysql_execute_command(void) else res = load_master_data(thd); break; + +#endif /*!EMBEDDED_LIBRARY*/ #ifdef HAVE_INNOBASE_DB case SQLCOM_SHOW_INNODB_STATUS: @@ -1546,6 +1550,7 @@ mysql_execute_command(void) } #endif +#ifndef EMBEDDED_LIBRARY case SQLCOM_LOAD_MASTER_TABLE: { if (!tables->db) @@ -1572,6 +1577,8 @@ mysql_execute_command(void) UNLOCK_ACTIVE_MI; break; } +#endif /*!EMBEDDED_LIBRARY*/ + case SQLCOM_CREATE_TABLE: { ulong want_priv= ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) ? @@ -1676,6 +1683,7 @@ mysql_execute_command(void) res = mysql_create_index(thd, tables, lex->key_list); break; +#ifndef EMBEDDED_LIBRARY case SQLCOM_SLAVE_START: { LOCK_ACTIVE_MI; @@ -1708,6 +1716,8 @@ mysql_execute_command(void) UNLOCK_ACTIVE_MI; break; } +#endif /*!EMBEDDED_LIBRARY*/ + case SQLCOM_ALTER_TABLE: #if defined(DONT_ALLOW_SHOW_COMMANDS) send_error(&thd->net,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */ -- cgit v1.2.1 From 8272be9412ecf6566192260df7217a1bec7ffc99 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 9 Sep 2003 20:06:50 +0300 Subject: Cleaned up last bug fixes Fix bug in SHOW GRANTS when there is a column privilege but no table privilege include/mysql.h: Make server_inited external libmysqld/libmysqld.c: Remove reference to (wrong) external variable mysql-test/r/grant.result: Fixed up grant test to not user 'user1' or 'user2' Check for bug in SHOW GRANTS when there is a column privilege but no table privilege mysql-test/r/mix_innodb_myisam_binlog.result: Change to use tables t1 and t2 mysql-test/t/grant.test: Fixed up grant test to not user 'user1' or 'user2' Check for bug in SHOW GRANTS when there is a column privilege but no table privilege mysql-test/t/mix_innodb_myisam_binlog.test: Change to use tables t1 and t2 sql/sql_acl.cc: Fix bug in SHOW GRANTS when there is a column privilege but no table privilege sql/sql_parse.cc: Use HAVE_REPLICATION instead of EMBEDDED_LIBRARY --- sql/sql_acl.cc | 6 ++++-- sql/sql_parse.cc | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'sql') diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index b76bbe8c730..0dbbb1cee70 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3091,17 +3091,19 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) if ((table_access | grant_table->cols) != 0) { String global(buff,sizeof(buff)); + ulong test_access= (table_access | grant_table->cols) & ~GRANT_ACL; + global.length(0); global.append("GRANT ",6); if (test_all_bits(table_access, (TABLE_ACLS & ~GRANT_ACL))) global.append("ALL PRIVILEGES",14); - else if (!(table_access & ~GRANT_ACL)) + else if (!test_access) global.append("USAGE",5); else { int found= 0; - ulong j,test_access= (table_access | grant_table->cols) & ~GRANT_ACL; + ulong j; for (counter= 0, j= SELECT_ACL; j <= TABLE_ACLS; counter++, j<<= 1) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 4482342f4ce..4d010ac9a4b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1500,7 +1500,7 @@ mysql_execute_command(void) break; } -#ifndef EMBEDDED_LIBRARY +#ifdef HAVE_REPLICATION case SQLCOM_CHANGE_MASTER: { if (check_global_access(thd, SUPER_ACL)) @@ -1538,7 +1538,7 @@ mysql_execute_command(void) res = load_master_data(thd); break; -#endif /*!EMBEDDED_LIBRARY*/ +#endif /* HAVE_REPLICATION */ #ifdef HAVE_INNOBASE_DB case SQLCOM_SHOW_INNODB_STATUS: @@ -1550,7 +1550,7 @@ mysql_execute_command(void) } #endif -#ifndef EMBEDDED_LIBRARY +#ifdef HAVE_REPLICATION case SQLCOM_LOAD_MASTER_TABLE: { if (!tables->db) @@ -1577,7 +1577,7 @@ mysql_execute_command(void) UNLOCK_ACTIVE_MI; break; } -#endif /*!EMBEDDED_LIBRARY*/ +#endif /* HAVE_REPLICATION */ case SQLCOM_CREATE_TABLE: { @@ -1683,7 +1683,7 @@ mysql_execute_command(void) res = mysql_create_index(thd, tables, lex->key_list); break; -#ifndef EMBEDDED_LIBRARY +#ifdef HAVE_REPLICATION case SQLCOM_SLAVE_START: { LOCK_ACTIVE_MI; @@ -1716,7 +1716,7 @@ mysql_execute_command(void) UNLOCK_ACTIVE_MI; break; } -#endif /*!EMBEDDED_LIBRARY*/ +#endif /* HAVE_REPLICATION */ case SQLCOM_ALTER_TABLE: #if defined(DONT_ALLOW_SHOW_COMMANDS) -- cgit v1.2.1