Commit 65b9f4a3 authored by Sinisa@sinisa.nasamreza.org's avatar Sinisa@sinisa.nasamreza.org

Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-4.1

into sinisa.nasamreza.org:/mnt/work/mysql-4.1
parents 05982c85 165b3960
......@@ -37,3 +37,9 @@ cast("2001-1-1" as datetime) = "2001-01-01 00:00:00"
select cast("1:2:3" as TIME) = "1:02:03";
cast("1:2:3" as TIME) = "1:02:03"
0
select cast(NULL as DATE);
cast(NULL as DATE)
NULL
select cast(NULL as BINARY);
cast(NULL as BINARY)
NULL
......@@ -333,4 +333,5 @@ check table t1,t2;
Table Op Msg_type Msg_text
test.t1 check status OK
test.t2 check status OK
select max(a) +1, max(a) +2 into @xx,@yy from t1;
drop table t1,t2;
......@@ -20,3 +20,5 @@ select cast("1:2:3" as TIME);
select cast("2001-1-1" as date) = "2001-01-01";
select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00";
select cast("1:2:3" as TIME) = "1:02:03";
select cast(NULL as DATE);
select cast(NULL as BINARY);
......@@ -241,5 +241,6 @@ select @@key_buffer_size;
select * from t1 where a=2;
select * from t2 where a=3;
check table t1,t2;
select max(a) +1, max(a) +2 into @xx,@yy from t1;
drop table t1,t2;
......@@ -1252,7 +1252,16 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
}
}
if (((*ref)->with_sum_func &&
/*
* The following conditional is changed as to correctly identify
* incorrect references in group functions or forward references
* with sub-select's / derived tables, while it prevents this
* check when Item_ref is created in an expression involving
* summing function, which is to be placed in the user variable.
*
*/
if (((*ref)->with_sum_func && name &&
(depended_from ||
!(thd->lex.current_select->linkage != GLOBAL_OPTIONS_TYPE &&
thd->lex.current_select->select_lex()->having_fix_field))) ||
......
......@@ -769,6 +769,7 @@ Item_func_if::val_str(String *str)
{
Item *arg= args[0]->val_int() ? args[1] : args[2];
String *res=arg->val_str(str);
if (res)
res->set_charset(charset());
null_value=arg->null_value;
return res;
......
......@@ -512,6 +512,7 @@ class Item_func_binary :public Item_str_func
{
String *tmp=args[0]->val_str(a);
null_value=args[0]->null_value;
if (tmp)
tmp->set_charset(&my_charset_bin);
return tmp;
}
......
......@@ -527,6 +527,7 @@ class Item_typecast :public Item_str_func
{
String *tmp=args[0]->val_str(a);
null_value=args[0]->null_value;
if (tmp)
tmp->set_charset(charset());
return tmp;
}
......
......@@ -248,6 +248,7 @@ int st_select_lex_unit::exec()
SELECT_LEX_NODE *lex_select_save= thd->lex.current_select;
SELECT_LEX *select_cursor=first_select_in_union(), *last_select;
LINT_INIT(last_select);
bool do_print_slow=0;
if (executed && !(dependent || uncacheable))
DBUG_RETURN(0);
......@@ -313,6 +314,7 @@ int st_select_lex_unit::exec()
thd->lex.current_select= lex_select_save;
DBUG_RETURN(res);
}
do_print_slow = do_print_slow || (select_cursor->options & (QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED));
}
}
optimized= 1;
......@@ -325,7 +327,6 @@ int st_select_lex_unit::exec()
{
List<Item_func_match> empty_list;
empty_list.empty();
thd->lex.select_lex.ftfunc_list= &empty_list;
if (!thd->is_fatal_error) // Check if EOM
{
......@@ -338,6 +339,8 @@ int st_select_lex_unit::exec()
select_limit_cnt= HA_POS_ERROR; // no limit
if (select_limit_cnt == HA_POS_ERROR)
thd->options&= ~OPTION_FOUND_ROWS;
fake_select->ftfunc_list= &empty_list;
res= mysql_select(thd, &ref_pointer_array, &result_table_list,
0, item_list, NULL,
global_parameters->order_list.elements,
......@@ -348,9 +351,10 @@ int st_select_lex_unit::exec()
thd->limit_found_rows = (ulonglong)table->file->records;
fake_select->exclude();
delete fake_select;
if (select_cursor == &thd->lex.select_lex && !do_print_slow)
select_cursor->options &= ~(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED);
}
}
thd->lex.select_lex.ftfunc_list= &thd->lex.select_lex.ftfunc_list_alloc;
thd->lex.current_select= lex_select_save;
DBUG_RETURN(res);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment