summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/select_found.result16
-rw-r--r--mysql-test/t/select_found.test20
2 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
index 04eb2c90d31..92758fa134b 100644
--- a/mysql-test/r/select_found.result
+++ b/mysql-test/r/select_found.result
@@ -332,3 +332,19 @@ select found_rows() as count;
count
2
drop table t1, t2;
+create table t1 (i int, v varchar(64), key (i));
+select sql_calc_found_rows * from t1 where i = 0 order by v limit 59,2;
+i v
+0 foo
+0 foo
+select found_rows();
+found_rows()
+75
+select sql_calc_found_rows * from t1 ignore index (i) where i = 0 order by v limit 59,2;
+i v
+0 foo
+0 foo
+select found_rows();
+found_rows()
+75
+drop table t1;
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test
index d529dc415e7..88940eaf2b8 100644
--- a/mysql-test/t/select_found.test
+++ b/mysql-test/t/select_found.test
@@ -257,3 +257,23 @@ select sql_calc_found_rows 1 as res from t1 left join t2 on i1 = i2 where v2 = 5
select found_rows() as count;
drop table t1, t2;
+#
+# MDEV-7219 SQL_CALC_FOUND_ROWS yields wrong result
+#
+create table t1 (i int, v varchar(64), key (i));
+
+--disable_query_log
+let $1=150;
+while ($1)
+{
+ eval insert into t1 values ($1 % 2, 'foo');
+ dec $1;
+}
+--enable_query_log
+
+select sql_calc_found_rows * from t1 where i = 0 order by v limit 59,2;
+select found_rows();
+select sql_calc_found_rows * from t1 ignore index (i) where i = 0 order by v limit 59,2;
+select found_rows();
+drop table t1;
+