summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@macbook.local>2007-09-24 10:30:50 +0200
committerunknown <gkodinov/kgeorge@macbook.local>2007-09-24 10:30:50 +0200
commitea1a4ae287f0ecb62fc45955d117b1e30bcbf38f (patch)
tree05ff4af64a4fc7aea69b1d386b670bec494353c6 /mysql-test
parentbd8e7fee1f260b6f5b9b39c67bb6e701eace3cae (diff)
parent053907318516bb8d25f5ae8cb0367d1ebd327158 (diff)
downloadmariadb-git-ea1a4ae287f0ecb62fc45955d117b1e30bcbf38f.tar.gz
merge of bug 28701 5.0-opt -> 5.1-opt
sql/sql_view.cc: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/view.result13
-rw-r--r--mysql-test/t/view.test20
2 files changed, 31 insertions, 2 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 8a926d44f5f..23a40367cd9 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -625,7 +625,7 @@ drop table t1;
create table t1 (a int, b int);
create view v1 as select a, sum(b) from t1 group by a;
select b from v1 use index (some_index) where b=1;
-ERROR 42000: Key 'some_index' doesn't exist in table 'v1'
+ERROR 42000: Incorrect usage of USE INDEX and VIEW
drop view v1;
drop table t1;
create table t1 (col1 char(5),col2 char(5));
@@ -3559,6 +3559,17 @@ table_name is_updatable
v1 NO
drop view v1;
drop table t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT * FROM v1 USE KEY(non_existant);
+ERROR HY000: Incorrect usage of USE INDEX and VIEW
+SELECT * FROM v1 FORCE KEY(non_existant);
+ERROR HY000: Incorrect usage of FORCE INDEX and VIEW
+SELECT * FROM v1 IGNORE KEY(non_existant);
+ERROR HY000: Incorrect usage of IGNORE INDEX and VIEW
+DROP VIEW v1;
+DROP TABLE t1;
End of 5.0 tests.
DROP DATABASE IF EXISTS `d-1`;
CREATE DATABASE `d-1`;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 67354c14cff..341a17eb291 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -510,7 +510,7 @@ drop table t1;
#
create table t1 (a int, b int);
create view v1 as select a, sum(b) from t1 group by a;
--- error 1176
+--error ER_WRONG_USAGE
select b from v1 use index (some_index) where b=1;
drop view v1;
drop table t1;
@@ -3415,6 +3415,24 @@ select table_name, is_updatable from information_schema.views
drop view v1;
drop table t1;
+#
+# Bug #28701: SELECTs from VIEWs completely ignore USE/FORCE KEY, allowing
+# invalid statements
+#
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE VIEW v1 AS SELECT * FROM t1;
+--error ER_WRONG_USAGE
+SELECT * FROM v1 USE KEY(non_existant);
+--error ER_WRONG_USAGE
+SELECT * FROM v1 FORCE KEY(non_existant);
+--error ER_WRONG_USAGE
+SELECT * FROM v1 IGNORE KEY(non_existant);
+
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo End of 5.0 tests.
#