From 672a695f8f37da99b09180958076752231f09728 Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Wed, 25 Dec 2002 15:07:36 +0200 Subject: [PATCH] bug fixes and tests ... --- mysql-test/r/update.result | 5 ++++- mysql-test/t/update.test | 5 ++++- sql/sql_union.cc | 7 ++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index ba5c1c6e28f..60c975b540e 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -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); 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; +create table t2 (a int not null, b int not null); +insert into t2 values (1,1),(1,2),(1,3); select * from t1; a b 1 4 1 2 1 4 -drop table t1; +update t1 set b=(select distinct 1 from (select * from t2) a); +drop table t1,t2; diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 5cbbd2a350e..24620982cda 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -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); 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; +create table t2 (a int not null, b int not null); +insert into t2 values (1,1),(1,2),(1,3); select * from t1; -drop table t1; +update t1 set b=(select distinct 1 from (select * from t2) a); +drop table t1,t2; diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 10175bfe345..cdd34977e5a 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -279,9 +279,10 @@ int st_select_lex_unit::exec() } if (!thd->fatal_error) // Check if EOM { - offset_limit_cnt= global_parameters->offset_limit; - select_limit_cnt= global_parameters->select_limit+ - global_parameters->offset_limit; + SELECT_LEX *sl=thd->lex.current_select->master_unit()->first_select(); + offset_limit_cnt= (sl->braces) ? global_parameters->offset_limit : 0; + select_limit_cnt= (sl->braces) ? global_parameters->select_limit+ + global_parameters->offset_limit : HA_POS_ERROR; if (select_limit_cnt < global_parameters->select_limit) select_limit_cnt= HA_POS_ERROR; // no limit if (select_limit_cnt == HA_POS_ERROR)