summaryrefslogtreecommitdiff
path: root/mysql-test/t/select_found.test
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-03-19 20:33:12 +0100
committerSergei Golubchik <sergii@pisem.net>2014-03-19 20:33:12 +0100
commit9418bd9c2167ef6a75d7d1bfaaf5e2cf94d09bae (patch)
tree7555f2df23c72b1b6eea47aab5542be24742f94c /mysql-test/t/select_found.test
parent1fa1ea0f2df62796a89df8f00f49a4e77d7cf478 (diff)
downloadmariadb-git-9418bd9c2167ef6a75d7d1bfaaf5e2cf94d09bae.tar.gz
MDEV-5898 FOUND_ROWS() return incorrect value when using DISTINCT
revert the fix for MDEV-5549, use a different approach.
Diffstat (limited to 'mysql-test/t/select_found.test')
-rw-r--r--mysql-test/t/select_found.test40
1 files changed, 40 insertions, 0 deletions
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test
index d6bca6b19b1..684ae54b517 100644
--- a/mysql-test/t/select_found.test
+++ b/mysql-test/t/select_found.test
@@ -208,3 +208,43 @@ select f1 from t1,t2 where f1=f3 and f2=3 order by f1;
select found_rows();
drop table t1, t2;
+create table t1 (
+ a1 int auto_increment primary key,
+ b1 datetime,
+ c1 int
+);
+
+insert t1 (a1) values (null);
+insert t1 (a1) select null from t1;
+insert t1 (a1) select null from t1;
+insert t1 (a1) select null from t1;
+insert t1 (a1) select null from t1;
+insert t1 (a1) select null from t1;
+insert t1 (a1) select null from t1;
+insert t1 (a1) select null from t1;
+insert t1 (a1) select null from t1;
+insert t1 (a1) select null from t1;
+update t1 set c1=a1 % 2;
+
+create table t2 (
+ a2 int,
+ b2 int,
+ c2 char(16) default '',
+ primary key (a2, b2)
+);
+
+insert t2 select a1, 1, 'ok' from t1;
+insert t2 select a1, 2, 'ko' from t1;
+insert t2 select a1, 3, 'ko' from t1;
+insert t2 select a1, 4, 'ok' from t1;
+insert t2 select a1, 5, 'ok' from t1;
+
+--disable_result_log
+select sql_calc_found_rows distinct a1,b1,c2 from t1 join t2 on a2=a1
+ where a1 <= 256 and c1=0 and c2='ok' order by b1 desc, a1 desc limit 46;
+--enable_result_log
+
+select found_rows();
+
+drop table t1, t2;
+