summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/select_found.result33
-rw-r--r--mysql-test/t/select_found.test40
2 files changed, 73 insertions, 0 deletions
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
index ee6d309f005..07c7b7939af 100644
--- a/mysql-test/r/select_found.result
+++ b/mysql-test/r/select_found.result
@@ -291,3 +291,36 @@ select found_rows();
found_rows()
1
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;
+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;
+select found_rows();
+found_rows()
+128
+drop table t1, t2;
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;
+