Commit 740adf71 authored by unknown's avatar unknown

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1

into sanja.is.com.ua:/home/bell/mysql/bk/work-in-4.1


mysql-test/r/subselect.result:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
parents 1f61635d 933e16a3
...@@ -1082,3 +1082,20 @@ Invalid use of group function ...@@ -1082,3 +1082,20 @@ Invalid use of group function
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
Invalid use of group function Invalid use of group function
drop table t1; 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)); ...@@ -673,3 +673,20 @@ UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
-- error 1111 -- error 1111
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
drop table t1; 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, ...@@ -400,6 +400,7 @@ int mysql_multi_update(THD *thd,
table_list->grant.want_privilege=(SELECT_ACL & ~table_list->grant.privilege); table_list->grant.want_privilege=(SELECT_ACL & ~table_list->grant.privilege);
if ((res=open_and_lock_tables(thd,table_list))) if ((res=open_and_lock_tables(thd,table_list)))
DBUG_RETURN(res); DBUG_RETURN(res);
fix_tables_pointers(thd->lex.all_selects_list);
thd->select_limit=HA_POS_ERROR; thd->select_limit=HA_POS_ERROR;
if (setup_fields(thd, 0, table_list, *fields, 1, 0, 0)) if (setup_fields(thd, 0, table_list, *fields, 1, 0, 0))
...@@ -408,7 +409,7 @@ int mysql_multi_update(THD *thd, ...@@ -408,7 +409,7 @@ int mysql_multi_update(THD *thd,
/* /*
Count tables and setup timestamp handling 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; TABLE *table= tl->table;
if (table->timestamp_field) if (table->timestamp_field)
...@@ -426,7 +427,8 @@ int mysql_multi_update(THD *thd, ...@@ -426,7 +427,8 @@ int mysql_multi_update(THD *thd,
List<Item> total_list; List<Item> total_list;
res= mysql_select(thd, &select_lex->ref_pointer_array, 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, conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL,
(ORDER *)NULL, (ORDER *)NULL,
options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK, options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK,
......
...@@ -3399,8 +3399,8 @@ update: ...@@ -3399,8 +3399,8 @@ update:
UPDATE_SYM UPDATE_SYM
{ {
LEX *lex= Lex; LEX *lex= Lex;
mysql_init_select(lex);
lex->sql_command= SQLCOM_UPDATE; lex->sql_command= SQLCOM_UPDATE;
lex->select_lex.init_order();
} }
opt_low_priority opt_ignore join_table_list opt_low_priority opt_ignore join_table_list
SET update_list where_clause opt_order_clause delete_limit_clause SET update_list where_clause opt_order_clause delete_limit_clause
...@@ -3408,7 +3408,7 @@ update: ...@@ -3408,7 +3408,7 @@ update:
LEX *lex= Lex; LEX *lex= Lex;
Select->set_lock_for_tables($3); Select->set_lock_for_tables($3);
if (lex->select_lex.table_list.elements > 1) if (lex->select_lex.table_list.elements > 1)
lex->sql_command=SQLCOM_UPDATE_MULTI; lex->sql_command= SQLCOM_UPDATE_MULTI;
} }
; ;
......
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