mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-4.1-opt
into moonbone.local:/mnt/gentoo64/work/clean-5.0-opt-mysql mysql-test/t/update.test: Auto merged mysql-test/r/update.result: Manually merged sql/sql_base.cc: Manually merged sql/sql_select.cc: Manually merged
This commit is contained in:
@ -377,6 +377,10 @@ create table t1(f1 int, `*f2` int);
|
||||
insert into t1 values (1,1);
|
||||
update t1 set `*f2`=1;
|
||||
drop table t1;
|
||||
create table t1(f1 int);
|
||||
update t1 set f2=1 order by f2;
|
||||
ERROR 42S22: Unknown column 'f2' in 'order clause'
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
request_id int unsigned NOT NULL auto_increment,
|
||||
user_id varchar(12) default NULL,
|
||||
|
@ -306,6 +306,14 @@ create table t1(f1 int, `*f2` int);
|
||||
insert into t1 values (1,1);
|
||||
update t1 set `*f2`=1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#25126: Wrongly resolved field leads to a crash
|
||||
#
|
||||
create table t1(f1 int);
|
||||
--error 1054
|
||||
update t1 set f2=1 order by f2;
|
||||
drop table t1;
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
@ -4420,12 +4420,15 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
|
||||
bool save_set_query_id= thd->set_query_id;
|
||||
nesting_map save_allow_sum_func= thd->lex->allow_sum_func;
|
||||
List_iterator<Item> it(fields);
|
||||
bool save_is_item_list_lookup;
|
||||
DBUG_ENTER("setup_fields");
|
||||
|
||||
thd->set_query_id=set_query_id;
|
||||
if (allow_sum_func)
|
||||
thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level;
|
||||
thd->where= THD::DEFAULT_WHERE;
|
||||
save_is_item_list_lookup= thd->lex->current_select->is_item_list_lookup;
|
||||
thd->lex->current_select->is_item_list_lookup= 0;
|
||||
|
||||
/*
|
||||
To prevent fail on forward lookup we fill it with zerows,
|
||||
@ -4448,6 +4451,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
|
||||
if (!item->fixed && item->fix_fields(thd, it.ref()) ||
|
||||
(item= *(it.ref()))->check_cols(1))
|
||||
{
|
||||
thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
|
||||
thd->lex->allow_sum_func= save_allow_sum_func;
|
||||
thd->set_query_id= save_set_query_id;
|
||||
DBUG_RETURN(TRUE); /* purecov: inspected */
|
||||
@ -4460,6 +4464,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
|
||||
thd->used_tables|= item->used_tables();
|
||||
thd->lex->current_select->cur_pos_in_select_list++;
|
||||
}
|
||||
thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
|
||||
thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS;
|
||||
|
||||
thd->lex->allow_sum_func= save_allow_sum_func;
|
||||
@ -4956,6 +4961,8 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
|
||||
*/
|
||||
bool it_is_update= (select_lex == &thd->lex->select_lex) &&
|
||||
thd->lex->which_check_option_applicable();
|
||||
bool save_is_item_list_lookup= select_lex->is_item_list_lookup;
|
||||
select_lex->is_item_list_lookup= 0;
|
||||
DBUG_ENTER("setup_conds");
|
||||
|
||||
if (select_lex->conds_processed_with_permanent_arena ||
|
||||
@ -5030,9 +5037,11 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
|
||||
select_lex->where= *conds;
|
||||
select_lex->conds_processed_with_permanent_arena= 1;
|
||||
}
|
||||
thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
|
||||
DBUG_RETURN(test(thd->net.report_error));
|
||||
|
||||
err_no_arena:
|
||||
select_lex->is_item_list_lookup= save_is_item_list_lookup;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
|
@ -396,6 +396,7 @@ JOIN::prepare(Item ***rref_pointer_array,
|
||||
join_list= &select_lex->top_join_list;
|
||||
union_part= (unit_arg->first_select()->next_select() != 0);
|
||||
|
||||
thd->lex->current_select->is_item_list_lookup= 1;
|
||||
/*
|
||||
If we have already executed SELECT, then it have not sense to prevent
|
||||
its table from update (see unique_table())
|
||||
@ -13265,16 +13266,11 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
|
||||
We check order_item->fixed because Item_func_group_concat can put
|
||||
arguments for which fix_fields already was called.
|
||||
*/
|
||||
thd->lex->current_select->is_item_list_lookup= 1;
|
||||
if (!order_item->fixed &&
|
||||
(order_item->fix_fields(thd, order->item) ||
|
||||
(order_item= *order->item)->check_cols(1) ||
|
||||
thd->is_fatal_error))
|
||||
{
|
||||
thd->lex->current_select->is_item_list_lookup= 0;
|
||||
return TRUE; /* Wrong field. */
|
||||
}
|
||||
thd->lex->current_select->is_item_list_lookup= 0;
|
||||
|
||||
uint el= all_fields.elements;
|
||||
all_fields.push_front(order_item); /* Add new field to field list. */
|
||||
|
Reference in New Issue
Block a user