fixed st_select_lex initialization
fixed mustiupdate subselect compatibility (bug 217) mysql-test/r/subselect.result: test of multi-update & subselect mysql-test/t/subselect.test: test of multi-update & subselect sql/sql_update.cc: added subselect compatibility to query cache sql/sql_yacc.yy: right st_select_lex initialization layout fix
This commit is contained in:
parent
308362a0e3
commit
933e16a388
@ -1082,3 +1082,20 @@ Invalid use of group function
|
||||
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
|
||||
Invalid use of group function
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
id int(11) default NULL
|
||||
) TYPE=MyISAM CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES (1),(1),(2),(2),(1),(3);
|
||||
CREATE TABLE t2 (
|
||||
id int(11) default NULL,
|
||||
name varchar(15) default NULL
|
||||
) TYPE=MyISAM CHARSET=latin1;
|
||||
INSERT INTO t2 VALUES (4,'vita'), (1,'vita'), (2,'vita'), (1,'vita');
|
||||
update t1, t2 set t2.name='lenka' where t2.id in (select id from t1);
|
||||
select * from t2;
|
||||
id name
|
||||
4 vita
|
||||
1 lenka
|
||||
2 lenka
|
||||
1 lenka
|
||||
drop table t1,t2;
|
||||
|
@ -673,3 +673,20 @@ UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
|
||||
-- error 1111
|
||||
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Multi update test
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
id int(11) default NULL
|
||||
) TYPE=MyISAM CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES (1),(1),(2),(2),(1),(3);
|
||||
CREATE TABLE t2 (
|
||||
id int(11) default NULL,
|
||||
name varchar(15) default NULL
|
||||
) TYPE=MyISAM CHARSET=latin1;
|
||||
|
||||
INSERT INTO t2 VALUES (4,'vita'), (1,'vita'), (2,'vita'), (1,'vita');
|
||||
update t1, t2 set t2.name='lenka' where t2.id in (select id from t1);
|
||||
select * from t2;
|
||||
drop table t1,t2;
|
||||
|
@ -400,6 +400,7 @@ int mysql_multi_update(THD *thd,
|
||||
table_list->grant.want_privilege=(SELECT_ACL & ~table_list->grant.privilege);
|
||||
if ((res=open_and_lock_tables(thd,table_list)))
|
||||
DBUG_RETURN(res);
|
||||
fix_tables_pointers(thd->lex.all_selects_list);
|
||||
|
||||
thd->select_limit=HA_POS_ERROR;
|
||||
if (setup_fields(thd, 0, table_list, *fields, 1, 0, 0))
|
||||
@ -408,7 +409,7 @@ int mysql_multi_update(THD *thd,
|
||||
/*
|
||||
Count tables and setup timestamp handling
|
||||
*/
|
||||
for (tl= (TABLE_LIST*) table_list ; tl ; tl=tl->next)
|
||||
for (tl= select_lex->get_table_list() ; tl ; tl=tl->next)
|
||||
{
|
||||
TABLE *table= tl->table;
|
||||
if (table->timestamp_field)
|
||||
@ -426,7 +427,8 @@ int mysql_multi_update(THD *thd,
|
||||
|
||||
List<Item> total_list;
|
||||
res= mysql_select(thd, &select_lex->ref_pointer_array,
|
||||
table_list, select_lex->with_wild, total_list,
|
||||
select_lex->get_table_list(), select_lex->with_wild,
|
||||
total_list,
|
||||
conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL,
|
||||
(ORDER *)NULL,
|
||||
options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK,
|
||||
|
@ -3369,8 +3369,8 @@ update:
|
||||
UPDATE_SYM
|
||||
{
|
||||
LEX *lex= Lex;
|
||||
mysql_init_select(lex);
|
||||
lex->sql_command= SQLCOM_UPDATE;
|
||||
lex->select_lex.init_order();
|
||||
}
|
||||
opt_low_priority opt_ignore join_table_list
|
||||
SET update_list where_clause opt_order_clause delete_limit_clause
|
||||
@ -3378,7 +3378,7 @@ update:
|
||||
LEX *lex= Lex;
|
||||
Select->set_lock_for_tables($3);
|
||||
if (lex->select_lex.table_list.elements > 1)
|
||||
lex->sql_command=SQLCOM_UPDATE_MULTI;
|
||||
lex->sql_command= SQLCOM_UPDATE_MULTI;
|
||||
}
|
||||
;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user