diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.h | 12 | ||||
-rw-r--r-- | sql/item_func.cc | 3 | ||||
-rw-r--r-- | sql/sql_select.cc | 3 |
3 files changed, 8 insertions, 10 deletions
diff --git a/sql/item.h b/sql/item.h index 832fc775016..984c4d0c7f5 100644 --- a/sql/item.h +++ b/sql/item.h @@ -422,18 +422,14 @@ class Item_uint :public Item_int { public: Item_uint(const char *str_arg, uint length) : - Item_int(str_arg, (longlong) strtoull(str_arg,(char**) 0,10), length) {} - Item_uint(uint32 i) :Item_int((longlong) i, 10) {} + Item_int(str_arg, (longlong) strtoull(str_arg,(char**) 0,10), length) + { unsigned_flag= 1; } + Item_uint(uint32 i) :Item_int((longlong) i, 10) + { unsigned_flag= 1; } double val() { return ulonglong2double((ulonglong)value); } String *val_str(String*); Item *new_item() { return new Item_uint(name,max_length); } int save_in_field(Field *field, bool no_conversions); - bool fix_fields(THD *thd, struct st_table_list *list, Item **item) - { - bool res= Item::fix_fields(thd, list, item); - unsigned_flag= 1; - return res; - } void print(String *str); }; diff --git a/sql/item_func.cc b/sql/item_func.cc index e365398127a..2d98a7b8391 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -215,7 +215,8 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) { Item *item; /* We can't yet set item to *arg as fix_fields may change *arg */ - if ((*arg)->fix_fields(thd, tables, arg) || + /* We shouldn't call fix_fields() twice, so check 'fixed' field first */ + if ((!(*arg)->fixed && (*arg)->fix_fields(thd, tables, arg)) || (*arg)->check_cols(allowed_arg_cols)) return 1; /* purecov: inspected */ item= *arg; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index e49aff6d82c..13efad05eb9 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3451,6 +3451,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) tab->type=JT_ALL; use_quick_range=1; tab->use_quick=1; + tab->ref.key= -1; tab->ref.key_parts=0; // Don't use ref key. join->best_positions[i].records_read= rows2double(tab->quick->records); } @@ -7023,7 +7024,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, ref_key= -1; /* Test if constant range in WHERE */ - if (tab->ref.key >= 0) + if (tab->ref.key >= 0 && tab->ref.key_parts) { ref_key= tab->ref.key; ref_key_parts= tab->ref.key_parts; |