summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@tik.mysql.fi>2001-05-23 02:40:46 +0300
committerunknown <monty@tik.mysql.fi>2001-05-23 02:40:46 +0300
commit4b799725034bd5f2d7cda76d8a5bcb3b42cb88f3 (patch)
tree22a09c551394dd62383433e28ef919ca86f669b7 /mysql-test
parent8ec67661b4327060a12f9888a1179d5161e4b9c4 (diff)
downloadmariadb-git-4b799725034bd5f2d7cda76d8a5bcb3b42cb88f3.tar.gz
Don't write rows in MyISAM tables when using count(distinct)
Don't read MyISAM header when running without locking include/myisam.h: Don't read header when running without locking. myisam/mi_locking.c: Don't update changed flag for temporary files. myisam/mi_open.c: Don't read header when running without locking. myisam/mi_static.c: Don't read header when running without locking. sql/item_sum.cc: Don't write rows in MyISAM tables when using count(distinct) sql/mysqld.cc: Don't read MyISAM header when running without locking. Remove -Sg option. sql/sql_analyse.h: Remove duplicate header. sql/sql_select.cc: Cleaned up prototypes. Don't write rows to count(DISTINCT) MyISAM tables. sql/sql_select.h: Cleaned up prototypes. sql/table.h: A BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/select_found.result31
-rw-r--r--mysql-test/t/select_found.test20
2 files changed, 51 insertions, 0 deletions
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
new file mode 100644
index 00000000000..fcbe8958748
--- /dev/null
+++ b/mysql-test/r/select_found.result
@@ -0,0 +1,31 @@
+a b
+1 2
+2 3
+3 5
+4 5
+5 5
+6 6
+7 7
+8 9
+FOUND_ROWS()
+8
+a b
+1 2
+FOUND_ROWS()
+8
+a b
+8 9
+FOUND_ROWS()
+8
+b
+2
+FOUND_ROWS()
+6
+b c
+2 1
+FOUND_ROWS()
+6
+a b a b
+3 5 5 5
+FOUND_ROWS()
+8
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test
new file mode 100644
index 00000000000..d86ef1e0907
--- /dev/null
+++ b/mysql-test/t/select_found.test
@@ -0,0 +1,20 @@
+#
+# Testing of found_rows()
+#
+
+drop table if exists t1;
+create table t1 (a int not null auto_increment, b int not null, primary key(a));
+insert into t1 (b) values (2),(3),(5),(5),(5),(6),(7),(9);
+select SQL_CALC_FOUND_ROWS * from t1;
+select found_rows();
+select SQL_CALC_FOUND_ROWS * from t1 limit 1;
+select found_rows();
+select SQL_CALC_FOUND_ROWS * from t1 order by b desc limit 1;
+select found_rows();
+select SQL_CALC_FOUND_ROWS distinct b from t1 limit 1;
+select found_rows();
+select SQL_CALC_FOUND_ROWS b,count(*) as c from t1 group by b order by c limit 1;
+select found_rows();
+select SQL_CALC_FOUND_ROWS * from t1 left join t1 as t2 on (t1.b=t2.a) limit 2,1;
+select found_rows();
+drop table t1;