summaryrefslogtreecommitdiff
path: root/mysql-test/r/view.result
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2006-01-06 22:28:26 -0800
committerunknown <igor@rurik.mysql.com>2006-01-06 22:28:26 -0800
commit312c2f4759514c6594e630e6d1237b8875022328 (patch)
treeb8a215a1aea131a3018f2793e26e1c95276ef793 /mysql-test/r/view.result
parentbf1ebe98dfe51c7f7b13e783cd13d8362a26afbf (diff)
downloadmariadb-git-312c2f4759514c6594e630e6d1237b8875022328.tar.gz
Fixed bug #16016: MIN/MAX optimization was not applied to views.
mysql-test/r/view.result: Added a test case for bug #16016. mysql-test/t/view.test: Added a test case for bug #16016. sql/opt_sum.cc: Fixed bug #16016: MIN/MAX optimization was not applied to views. The fix employs the standard way of handling direct references to view fields.
Diffstat (limited to 'mysql-test/r/view.result')
-rw-r--r--mysql-test/r/view.result29
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index b9380dcf033..8b6d0787ada 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -2475,3 +2475,32 @@ alias1 alias2
5 5
drop view v2, v1;
drop table t1;
+CREATE TABLE t1 (a int PRIMARY KEY, b int);
+INSERT INTO t1 VALUES (2,20), (3,10), (1,10), (0,30), (5,10);
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT MAX(a) FROM t1;
+MAX(a)
+5
+SELECT MAX(a) FROM v1;
+MAX(a)
+5
+EXPLAIN SELECT MAX(a) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+EXPLAIN SELECT MAX(a) FROM v1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+SELECT MIN(a) FROM t1;
+MIN(a)
+0
+SELECT MIN(a) FROM v1;
+MIN(a)
+0
+EXPLAIN SELECT MIN(a) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+EXPLAIN SELECT MIN(a) FROM v1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+DROP VIEW v1;
+DROP TABLE t1;