From 2d2697ea8d6b6ef07836c9af06fc0d4eca6aa77b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 5 Jun 2014 15:59:46 +0200 Subject: MDEV-6221 SQL_CALC_FOUND_ROWS yields wrong result again replace another old "was there a filesort?" test with a correct "did filesort calculate found_rows?" test. --- mysql-test/r/select_found.result | 17 +++++++++++++++++ mysql-test/t/select_found.test | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result index 933c69055a1..04eb2c90d31 100644 --- a/mysql-test/r/select_found.result +++ b/mysql-test/r/select_found.result @@ -315,3 +315,20 @@ select found_rows(); found_rows() 128 drop table t1, t2; +create table t1 (i1 int, v1 int, primary key(i1,v1)); +insert into t1 values (1,1),(2,2),(3,3); +create table t2 (i2 int primary key, v2 int); +insert into t2 values (1,5),(2,5),(3,10); +select 1 as res from t1 left join t2 on i1 = i2 where v2 = 5 or v1 = 5 or v1 = 10 order by v1; +res +1 +1 +select sql_calc_found_rows 1 as res from t1 left join t2 on i1 = i2 where v2 = 5 or v1 = 5 or v1 = 10 order by v1 limit 1; +select found_rows() as count; +count +2 +select sql_calc_found_rows 1 as res from t1 left join t2 on i1 = i2 where v2 = 5 order by v1 limit 1; +select found_rows() as count; +count +2 +drop table t1, t2; diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test index 5571d51830b..d529dc415e7 100644 --- a/mysql-test/t/select_found.test +++ b/mysql-test/t/select_found.test @@ -241,3 +241,19 @@ select found_rows(); drop table t1, t2; +# +# MDEV-6221 SQL_CALC_FOUND_ROWS yields wrong result again +# +create table t1 (i1 int, v1 int, primary key(i1,v1)); +insert into t1 values (1,1),(2,2),(3,3); +create table t2 (i2 int primary key, v2 int); +insert into t2 values (1,5),(2,5),(3,10); +select 1 as res from t1 left join t2 on i1 = i2 where v2 = 5 or v1 = 5 or v1 = 10 order by v1; +--disable_result_log ONCE +select sql_calc_found_rows 1 as res from t1 left join t2 on i1 = i2 where v2 = 5 or v1 = 5 or v1 = 10 order by v1 limit 1; +select found_rows() as count; +--disable_result_log ONCE +select sql_calc_found_rows 1 as res from t1 left join t2 on i1 = i2 where v2 = 5 order by v1 limit 1; +select found_rows() as count; +drop table t1, t2; + -- cgit v1.2.1