From: Date: June 2 2005 9:56pm Subject: bk commit into 5.0 tree (patg:1.1933) BUG#9088 List-Archive: http://lists.mysql.com/internals/25539 X-Bug: 9088 Message-Id: <20050602195631.333DB4FF88C@radha.local> Below is the list of changes that have just been committed into a local 5.0 repository of patg. When patg 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://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.1933 05/06/02 21:56:00 patg@stripped +6 -0 In trying to solve bug#9088 "WHERE clause fails with BIGINT if value is between quotes", I've added some DBUG_ENTERs to some of the methods/functions that I have seen in the debugger, but not in the trace file sql/sql_select.cc 1.328 05/06/02 21:55:46 patg@stripped +14 -13 added debug for bug# 9088 sql/sql_parse.cc 1.438 05/06/02 21:55:45 patg@stripped +8 -7 added debug for bug# 9088 sql/sql_lex.cc 1.146 05/06/02 21:55:45 patg@stripped +2 -0 added debug for BUG# 9088 sql/item_subselect.cc 1.101 05/06/02 21:55:45 patg@stripped +2 -1 added debug for BUG# 9088 sql/item_cmpfunc.cc 1.147 05/06/02 21:55:45 patg@stripped +34 -15 added debug, trying to solve BUG#9088 "WHERE clause fails with BIGINT if value is between quotes sql/item.cc 1.126 05/06/02 21:55:44 patg@stripped +38 -26 added debug for BUG# 9088 # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: patg # Host: radha.local # Root: /Users/patg/mysql-5.0 --- 1.125/sql/item.cc Thu May 26 19:54:24 2005 +++ 1.126/sql/item.cc Thu Jun 2 21:55:44 2005 @@ -635,13 +635,14 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const { + DBUG_ENTER("Item_string::eq"); if (type() == item->type() && item->basic_const_item()) { if (binary_cmp) - return !stringcmp(&str_value, &item->str_value); - return !sortcmp(&str_value, &item->str_value, collation.collation); + DBUG_RETURN(!stringcmp(&str_value, &item->str_value)); + DBUG_RETURN(!sortcmp(&str_value, &item->str_value, collation.collation)); } - return 0; + DBUG_RETURN(0); } @@ -1477,9 +1478,10 @@ String *Item_decimal::val_str(String *result) { + DBUG_ENTER("Item_decimal::val_str"); result->set_charset(&my_charset_bin); my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, 0, 0, 0, result); - return result; + DBUG_RETURN(result); } void Item_decimal::print(String *str) @@ -1491,6 +1493,7 @@ bool Item_decimal::eq(const Item *item, bool binary_cmp) const { + DBUG_ENTER("Item_decimal::eq"); if (type() == item->type() && item->basic_const_item()) { /* @@ -1501,18 +1504,19 @@ */ Item *arg= (Item*) item; my_decimal *value= arg->val_decimal(0); - return !my_decimal_cmp(&decimal_value, value); + DBUG_RETURN(!my_decimal_cmp(&decimal_value, value)); } - return 0; + DBUG_RETURN(0); } String *Item_float::val_str(String *str) { + DBUG_ENTER("Item_float::val_str"); // following assert is redundant, because fixed=1 assigned in constructor DBUG_ASSERT(fixed == 1); str->set(value,decimals,&my_charset_bin); - return str; + DBUG_RETURN(str); } @@ -2233,6 +2237,7 @@ bool Item_param::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) { + DBUG_ENTER("Item_param::fix_fields"); DBUG_ASSERT(fixed == 0); SELECT_LEX *cursel= (SELECT_LEX *) thd->lex->current_select; @@ -2256,42 +2261,44 @@ } } fixed= 1; - return 0; + DBUG_RETURN(0); } bool Item_param::basic_const_item() const { + DBUG_ENTER("Item_param::basic_const_item"); if (state == NO_VALUE || state == TIME_VALUE) - return FALSE; - return TRUE; + DBUG_RETURN(FALSE); + DBUG_RETURN(TRUE); } Item * Item_param::new_item() { + DBUG_ENTER("Item_param::new_item"); /* see comments in the header file */ switch (state) { case NULL_VALUE: - return new Item_null(name); + DBUG_RETURN(new Item_null(name)); case INT_VALUE: - return (unsigned_flag ? + DBUG_RETURN((unsigned_flag ? new Item_uint(name, value.integer, max_length) : - new Item_int(name, value.integer, max_length)); + new Item_int(name, value.integer, max_length))); case REAL_VALUE: - return new Item_float(name, value.real, decimals, max_length); + DBUG_RETURN(new Item_float(name, value.real, decimals, max_length)); case STRING_VALUE: case LONG_DATA_VALUE: - return new Item_string(name, str_value.c_ptr_quick(), str_value.length(), - str_value.charset()); + DBUG_RETURN(new Item_string(name, str_value.c_ptr_quick(), str_value.length(), + str_value.charset())); case TIME_VALUE: break; case NO_VALUE: default: DBUG_ASSERT(0); }; - return 0; + DBUG_RETURN(0); } @@ -2299,6 +2306,7 @@ Item_param::eq(const Item *arg, bool binary_cmp) const { Item *item; + DBUG_ENTER("Item_param::eq"); if (!basic_const_item() || !arg->basic_const_item() || arg->type() != type()) return FALSE; /* @@ -2309,21 +2317,21 @@ switch (state) { case NULL_VALUE: - return TRUE; + DBUG_RETURN(TRUE); case INT_VALUE: - return value.integer == item->val_int() && - unsigned_flag == item->unsigned_flag; + DBUG_RETURN(value.integer == item->val_int() && + unsigned_flag == item->unsigned_flag); case REAL_VALUE: - return value.real == item->val_real(); + DBUG_RETURN(value.real == item->val_real()); case STRING_VALUE: case LONG_DATA_VALUE: if (binary_cmp) - return !stringcmp(&str_value, &item->str_value); - return !sortcmp(&str_value, &item->str_value, collation.collation); + DBUG_RETURN(!stringcmp(&str_value, &item->str_value)); + DBUG_RETURN(!sortcmp(&str_value, &item->str_value, collation.collation)); default: break; } - return FALSE; + DBUG_RETURN(FALSE); } /* End of Item_param related */ @@ -2396,11 +2404,12 @@ struct st_table_list *list, Item ** ref) { + DBUG_ENTER("Item::fix_fields"); // We do not check fields which are fixed during construction DBUG_ASSERT(fixed == 0 || basic_const_item()); fixed= 1; - return FALSE; + DBUG_RETURN(FALSE); } double Item_ref_null_helper::val_real() @@ -4686,8 +4695,9 @@ { Item *item= *ref; Item *new_item; + DBUG_ENTER("resolv_const_item"); if (item->basic_const_item()) - return; // Can't be better + DBUG_VOID_RETURN; // Can't be better Item_result res_type=item_cmp_type(comp_item->result_type(), item->result_type()); char *name=item->name; // Alloced by sql_alloc @@ -4743,6 +4753,8 @@ } if (new_item) thd->change_item_tree(ref, new_item); + + DBUG_VOID_RETURN; } /* --- 1.146/sql/item_cmpfunc.cc Thu May 26 19:54:24 2005 +++ 1.147/sql/item_cmpfunc.cc Thu Jun 2 21:55:45 2005 @@ -17,7 +17,7 @@ /* This file defines all compare functions */ -#ifdef USE_PRAGMA_IMPLEMENTATION +#ifdef __GNUC__ #pragma implementation // gcc: Class implementation #endif @@ -184,17 +184,27 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item) { + DBUG_ENTER("convert_constant_item"); + DBUG_PRINT("info", ("item->result_type %d", (*item)->result_type())); + if ((*item)->const_item()) { + DBUG_PRINT("info", ("item->const_item() TRUE")); if (!(*item)->save_in_field(field, 1) && !((*item)->null_value)) { + DBUG_PRINT("info", ("!(*item)->save_in_field(field, 1) && !((*item)->null_value)")); Item *tmp=new Item_int_with_ref(field->val_int(), *item); if (tmp) + { + DBUG_PRINT("info", ("tmp DEFINED, calling thd->change_item_tree")); thd->change_item_tree(item, tmp); - return 1; // Item was replaced + } + DBUG_PRINT("info", ("return 1")); + DBUG_RETURN(1); // Item was replaced } } - return 0; + DBUG_PRINT("info", ("return 0")); + DBUG_RETURN(0); } @@ -202,13 +212,14 @@ { max_length= 1; // Function returns 0 or 1 THD *thd= current_thd; + DBUG_ENTER("Item_bool_func2::fix_length_and_dec"); /* As some compare functions are generated after sql_yacc, we have to check for out of memory conditions here */ if (!args[0] || !args[1]) - return; + DBUG_VOID_RETURN; /* We allow to convert to Unicode character sets in some cases. @@ -227,7 +238,7 @@ if (args[0]->result_type() == STRING_RESULT && args[1]->result_type() == STRING_RESULT && agg_arg_charsets(coll, args, 2, MY_COLL_CMP_CONV)) - return; + DBUG_VOID_RETURN; // Make a special case of compare with fields to get nicer DATE comparisons @@ -235,7 +246,7 @@ if (functype() == LIKE_FUNC) // Disable conversion in case of LIKE function. { set_cmp_func(); - return; + DBUG_VOID_RETURN; } if (args[0]->type() == FIELD_ITEM) @@ -247,7 +258,7 @@ { cmp.set_cmp_func(this, tmp_arg, tmp_arg+1, INT_RESULT); // Works for all types. - return; + DBUG_VOID_RETURN; } } } @@ -260,11 +271,12 @@ { cmp.set_cmp_func(this, tmp_arg, tmp_arg+1, INT_RESULT); // Works for all types. - return; + DBUG_VOID_RETURN; } } } set_cmp_func(); + DBUG_VOID_RETURN; } @@ -756,8 +768,10 @@ void Item_func_equal::fix_length_and_dec() { + DBUG_ENTER("Item_func_equal::fix_length_and_dec"); Item_bool_func2::fix_length_and_dec(); maybe_null=null_value=0; + DBUG_VOID_RETURN; } longlong Item_func_equal::val_int() @@ -823,6 +837,7 @@ void Item_func_interval::fix_length_and_dec() { + DBUG_ENTER("Item_func_interval::fix_length_and_dec"); use_decimal_comparison= (row->el(0)->result_type() == DECIMAL_RESULT) || (row->el(0)->result_type() == INT_RESULT); if (row->cols() > 8) @@ -878,6 +893,7 @@ not_null_tables_cache= row->not_null_tables(); with_sum_func= with_sum_func || row->with_sum_func; const_item_cache&= row->const_item(); + DBUG_VOID_RETURN; } @@ -971,17 +987,18 @@ { max_length= 1; THD *thd= current_thd; + DBUG_ENTER("Item_func_between::fix_length_and_dec"); /* As some compare functions are generated after sql_yacc, we have to check for out of memory conditions here */ if (!args[0] || !args[1] || !args[2]) - return; + DBUG_VOID_RETURN; agg_cmp_type(&cmp_type, args, 3); if (cmp_type == STRING_RESULT && agg_arg_charsets(cmp_collation, args, 3, MY_COLL_CMP_CONV)) - return; + DBUG_VOID_RETURN; /* Make a special ease of compare with date/time and longlong fields. @@ -1314,6 +1331,7 @@ void Item_func_nullif::fix_length_and_dec() { + DBUG_ENTER("Item_fun_nullif::fix_length_and_dec"); Item_bool_func2::fix_length_and_dec(); maybe_null=1; if (args[0]) // Only false if EOM @@ -1324,7 +1342,7 @@ cached_result_type= args[0]->result_type(); if (cached_result_type == STRING_RESULT && agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV)) - return; + DBUG_VOID_RETURN; } } @@ -2742,15 +2760,16 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref) { + DBUG_ENTER("Item_fun_like::fix_fields"); DBUG_ASSERT(fixed == 0); if (Item_bool_func2::fix_fields(thd, tlist, ref) || escape_item->fix_fields(thd, tlist, &escape_item)) - return TRUE; + DBUG_RETURN(TRUE); if (!escape_item->const_during_execution()) { my_error(ER_WRONG_ARGUMENTS,MYF(0),"ESCAPE"); - return TRUE; + DBUG_RETURN(TRUE); } if (escape_item->const_item()) @@ -2768,7 +2787,7 @@ { String* res2 = args[1]->val_str(&tmp_value2); if (!res2) - return FALSE; // Null argument + DBUG_RETURN(FALSE); // Null argument const size_t len = res2->length(); const char* first = res2->ptr(); @@ -2801,7 +2820,7 @@ } } } - return FALSE; + DBUG_RETURN(FALSE); } #ifdef USE_REGEX --- 1.145/sql/sql_lex.cc Thu May 26 19:54:26 2005 +++ 1.146/sql/sql_lex.cc Thu Jun 2 21:55:45 2005 @@ -1839,6 +1839,7 @@ void st_lex::first_lists_tables_same() { TABLE_LIST *first_table= (TABLE_LIST*) select_lex.table_list.first; + DBUG_ENTER("st_lex::first_lists_tables_same"); if (query_tables != first_table && first_table != 0) { TABLE_LIST *next; @@ -1858,6 +1859,7 @@ first_table->prev_global= &query_tables; query_tables= first_table; } + DBUG_VOID_RETURN; } --- 1.437/sql/sql_parse.cc Fri May 27 18:30:33 2005 +++ 1.438/sql/sql_parse.cc Thu Jun 2 21:55:45 2005 @@ -2284,13 +2284,13 @@ if (lex->sql_command == SQLCOM_UPDATE_MULTI) { DBUG_PRINT("info",("need faked locked tables")); - + if (check_multi_update_lock(thd)) goto error; /* Fix for replication, the tables are opened and locked, now we pretend that we have performed a LOCK TABLES action */ - + fake_prev_lock= thd->locked_tables; if (thd->lock) thd->locked_tables= thd->lock; @@ -4812,6 +4812,7 @@ uint found=0; ulong found_access=0; TABLE_LIST *org_tables=tables; + DBUG_ENTER("check_table_access"); for (; tables; tables= tables->next_global) { if (tables->derived || tables->schema_table || tables->belong_to_view || @@ -4830,19 +4831,19 @@ { if (check_access(thd,want_access,tables->db,&tables->grant.privilege, 0, no_errors)) - return TRUE; // Access denied + DBUG_RETURN(TRUE); // Access denied found_access=tables->grant.privilege; found=1; } } else if (check_access(thd,want_access,tables->db,&tables->grant.privilege, 0, no_errors)) - return TRUE; + DBUG_RETURN(TRUE); } if (grant_option) - return check_grant(thd,want_access & ~EXTRA_ACL,org_tables, - test(want_access & EXTRA_ACL), UINT_MAX, no_errors); - return FALSE; + DBUG_RETURN(check_grant(thd,want_access & ~EXTRA_ACL,org_tables, + test(want_access & EXTRA_ACL), UINT_MAX, no_errors)); + DBUG_RETURN(FALSE); } --- 1.327/sql/sql_select.cc Thu May 26 19:54:26 2005 +++ 1.328/sql/sql_select.cc Thu Jun 2 21:55:46 2005 @@ -10482,8 +10482,9 @@ static COND * make_cond_for_table(COND *cond, table_map tables, table_map used_table) { + DBUG_ENTER("make_cond_for_table"); if (used_table && !(cond->used_tables() & used_table)) - return (COND*) 0; // Already checked + DBUG_RETURN((COND*) 0); // Already checked if (cond->type() == Item::COND_ITEM) { if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC) @@ -10491,7 +10492,7 @@ /* Create new top level AND item */ Item_cond_and *new_cond=new Item_cond_and; if (!new_cond) - return (COND*) 0; // OOM /* purecov: inspected */ + DBUG_RETURN((COND*) 0); // OOM /* purecov: inspected */ List_iterator li(*((Item_cond*) cond)->argument_list()); Item *item; while ((item=li++)) @@ -10502,9 +10503,9 @@ } switch (new_cond->argument_list()->elements) { case 0: - return (COND*) 0; // Always true + DBUG_RETURN((COND*) 0); // Always true case 1: - return new_cond->argument_list()->head(); + DBUG_RETURN(new_cond->argument_list()->head()); default: /* Item_cond_and do not need fix_fields for execution, its parameters @@ -10514,21 +10515,21 @@ new_cond->used_tables_cache= ((Item_cond_and*) cond)->used_tables_cache & tables; - return new_cond; + DBUG_RETURN(new_cond); } } else { // Or list Item_cond_or *new_cond=new Item_cond_or; if (!new_cond) - return (COND*) 0; // OOM /* purecov: inspected */ + DBUG_RETURN((COND*) 0); // OOM /* purecov: inspected */ List_iterator li(*((Item_cond*) cond)->argument_list()); Item *item; while ((item=li++)) { Item *fix=make_cond_for_table(item,tables,0L); if (!fix) - return (COND*) 0; // Always true + DBUG_RETURN((COND*) 0); // Always true new_cond->argument_list()->push_back(fix); } /* @@ -10538,7 +10539,7 @@ new_cond->quick_fix_field(); new_cond->used_tables_cache= ((Item_cond_or*) cond)->used_tables_cache; new_cond->top_level_item(); - return new_cond; + DBUG_RETURN(new_cond); } } @@ -10549,9 +10550,9 @@ */ if (cond->marker == 3 || (cond->used_tables() & ~tables)) - return (COND*) 0; // Can't check this yet + DBUG_RETURN((COND*) 0); // Can't check this yet if (cond->marker == 2 || cond->eq_cmp_result() == Item::COND_OK) - return cond; // Not boolean op + DBUG_RETURN(cond); // Not boolean op if (((Item_func*) cond)->functype() == Item_func::EQ_FUNC) { @@ -10561,17 +10562,17 @@ test_if_ref((Item_field*) left_item,right_item)) { cond->marker=3; // Checked when read - return (COND*) 0; + DBUG_RETURN((COND*) 0); } if (right_item->type() == Item::FIELD_ITEM && test_if_ref((Item_field*) right_item,left_item)) { cond->marker=3; // Checked when read - return (COND*) 0; + DBUG_RETURN((COND*) 0); } } cond->marker=2; - return cond; + DBUG_RETURN(cond); } static Item * --- 1.100/sql/item_subselect.cc Thu May 26 19:54:25 2005 +++ 1.101/sql/item_subselect.cc Thu Jun 2 21:55:45 2005 @@ -232,7 +232,8 @@ bool Item_subselect::const_item() const { - return const_item_cache; + DBUG_ENTER("Item_subselect::const_item"); + DBUG_RETURN(const_item_cache); } Item *Item_subselect::get_tmp_table_item(THD *thd)