Commit 1e687d19 authored by unknown's avatar unknown

bug fixes and tests ...


mysql-test/r/update.result:
  Test for update with subselect and derived table ...
mysql-test/t/update.test:
  Test for update with subselect and derived table ...
sql/sql_union.cc:
  Fix for usage of ORDER BY ... and / or LIMIT .... without braces
parent f46decc7
...@@ -106,9 +106,12 @@ create table t1 (a int not null, b int not null); ...@@ -106,9 +106,12 @@ create table t1 (a int not null, b int not null);
insert into t1 values (1,1),(1,2),(1,3); insert into t1 values (1,1),(1,2),(1,3);
update t1 set b=4 where a=1 order by b asc limit 1; update t1 set b=4 where a=1 order by b asc limit 1;
update t1 set b=4 where a=1 order by b desc limit 1; update t1 set b=4 where a=1 order by b desc limit 1;
create table t2 (a int not null, b int not null);
insert into t2 values (1,1),(1,2),(1,3);
select * from t1; select * from t1;
a b a b
1 4 1 4
1 2 1 2
1 4 1 4
drop table t1; update t1 set b=(select distinct 1 from (select * from t2) a);
drop table t1,t2;
...@@ -85,5 +85,8 @@ create table t1 (a int not null, b int not null); ...@@ -85,5 +85,8 @@ create table t1 (a int not null, b int not null);
insert into t1 values (1,1),(1,2),(1,3); insert into t1 values (1,1),(1,2),(1,3);
update t1 set b=4 where a=1 order by b asc limit 1; update t1 set b=4 where a=1 order by b asc limit 1;
update t1 set b=4 where a=1 order by b desc limit 1; update t1 set b=4 where a=1 order by b desc limit 1;
create table t2 (a int not null, b int not null);
insert into t2 values (1,1),(1,2),(1,3);
select * from t1; select * from t1;
drop table t1; update t1 set b=(select distinct 1 from (select * from t2) a);
drop table t1,t2;
...@@ -279,9 +279,10 @@ int st_select_lex_unit::exec() ...@@ -279,9 +279,10 @@ int st_select_lex_unit::exec()
} }
if (!thd->fatal_error) // Check if EOM if (!thd->fatal_error) // Check if EOM
{ {
offset_limit_cnt= global_parameters->offset_limit; SELECT_LEX *sl=thd->lex.current_select->master_unit()->first_select();
select_limit_cnt= global_parameters->select_limit+ offset_limit_cnt= (sl->braces) ? global_parameters->offset_limit : 0;
global_parameters->offset_limit; select_limit_cnt= (sl->braces) ? global_parameters->select_limit+
global_parameters->offset_limit : HA_POS_ERROR;
if (select_limit_cnt < global_parameters->select_limit) if (select_limit_cnt < global_parameters->select_limit)
select_limit_cnt= HA_POS_ERROR; // no limit select_limit_cnt= HA_POS_ERROR; // no limit
if (select_limit_cnt == HA_POS_ERROR) if (select_limit_cnt == HA_POS_ERROR)
......
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