summaryrefslogtreecommitdiff
path: root/mysql-test/t/view.test
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2007-02-10 00:00:07 +0300
committerunknown <evgen@moonbone.local>2007-02-10 00:00:07 +0300
commit308da65162429ae0d505a3e04736e57acfea11de (patch)
tree3d0a09437fbcbef918d34a77d0ba717620153d27 /mysql-test/t/view.test
parent762aa1c0bd6cb246eee418926985c4ac3187e2d1 (diff)
downloadmariadb-git-308da65162429ae0d505a3e04736e57acfea11de.tar.gz
Bug#12122: The MERGE algorithm isn't applicable if the ORDER BY clause is
present. A view created with CREATE VIEW ... ORDER BY ... cannot be resolved with the MERGE algorithm, even when no other part of the CREATE VIEW statement would require the view to be resolved using the TEMPTABLE algorithm. The check for presence of the ORDER BY clause in the underlying select is removed from the st_lex::can_be_merged() function. The ORDER BY list of the underlying select is appended to the ORDER BY list mysql-test/t/view.test: Added a test case for bug#12122: Views with ORDER BY can't be resolved using MERGE algorithm. mysql-test/r/view.result: Added a test case for bug#12122: Views with ORDER BY can't be resolved using MERGE algorithm. sql/sql_lex.cc: Bug#12122: Views with ORDER BY can't be resolved using MERGE algorithm. The st_lex::can_be_merged() function now allows views with the ORDER BY clause to be resolved using MERGE algorithm. The ORDER BY list of the view is appended to the ORDER BY list of the embedding select.
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r--mysql-test/t/view.test14
1 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 0fa5765bb64..7fdca1ff7e0 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3024,4 +3024,18 @@ SELECT * FROM t2;
DROP VIEW v1;
DROP TABLE t1,t2;
+#
+# Bug#12122: Views with ORDER BY can't be resolved using MERGE algorithm.
+#
+create table t1(f1 int, f2 int);
+insert into t1 values(1,2),(1,3),(1,1),(2,3),(2,1),(2,2);
+select * from t1;
+create view v1 as select * from t1 order by f2;
+select * from v1;
+explain extended select * from v1;
+select * from v1 order by f1;
+explain extended select * from v1 order by f1;
+drop view v1;
+drop table t1;
+
--echo End of 5.0 tests.