summaryrefslogtreecommitdiff
path: root/mysql-test/t/view.test
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2007-09-24 15:34:10 +0300
committerunknown <gkodinov/kgeorge@magare.gmz>2007-09-24 15:34:10 +0300
commitca448acc25f6502140a68942b2d6d043d3482708 (patch)
tree4b665af0959cfe98236833589fbc37a68cac25da /mysql-test/t/view.test
parent5d59c1e81b0bc779ff4aca3091e71869ba6136ac (diff)
downloadmariadb-git-ca448acc25f6502140a68942b2d6d043d3482708.tar.gz
Bug #28702: VIEWs defined with USE/FORCE KEY ignore that request
When storing the VIEW the CREATE VIEW command is reconstructed from the parse tree. While constructing the command string the index hints specified should also be printed. Fixed by adding code to print the index hints when printing a table in the FROM clause. mysql-test/r/view.result: Bug #28702: test case mysql-test/t/view.test: Bug #28702: test case sql/sql_select.cc: Bug #28702: preserve index hints in a VIEW definition. sql/table.h: Bug #28702: preserve index hints in a VIEW definition.
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r--mysql-test/t/view.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index e972ae06a63..e6c3a03c645 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3434,5 +3434,26 @@ DROP VIEW v1;
DROP TABLE t1;
+#
+# Bug #28702: VIEWs defined with USE/FORCE KEY ignore that request
+#
+CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0,
+ PRIMARY KEY(a), KEY (b));
+INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),();
+CREATE VIEW v1 AS SELECT * FROM t1 FORCE KEY (PRIMARY,b) ORDER BY a;
+SHOW CREATE VIEW v1;
+EXPLAIN SELECT * FROM v1;
+CREATE VIEW v2 AS SELECT * FROM t1 USE KEY () ORDER BY a;
+SHOW CREATE VIEW v2;
+EXPLAIN SELECT * FROM v2;
+CREATE VIEW v3 AS SELECT * FROM t1 IGNORE KEY (b) ORDER BY a;
+SHOW CREATE VIEW v3;
+EXPLAIN SELECT * FROM v3;
+
+DROP VIEW v1;
+DROP VIEW v2;
+DROP VIEW v3;
+DROP TABLE t1;
+
--echo End of 5.0 tests.