From fae74579e41c609b1997b549f29489855a84d537 Mon Sep 17 00:00:00 2001 From: "gkodinov/kgeorge@macbook.local" <> Date: Mon, 24 Sep 2007 13:02:59 +0200 Subject: [PATCH] merging bug 28701 to 5.1-opt --- mysql-test/r/view.result | 8 ++++---- sql/sql_view.cc | 7 ++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 23a40367cd9..03ed22115bc 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: Incorrect usage of USE INDEX and VIEW +ERROR HY000: Incorrect usage of index hints and VIEW drop view v1; drop table t1; create table t1 (col1 char(5),col2 char(5)); @@ -3563,11 +3563,11 @@ 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 +ERROR HY000: Incorrect usage of index hints and VIEW SELECT * FROM v1 FORCE KEY(non_existant); -ERROR HY000: Incorrect usage of FORCE INDEX and VIEW +ERROR HY000: Incorrect usage of index hints and VIEW SELECT * FROM v1 IGNORE KEY(non_existant); -ERROR HY000: Incorrect usage of IGNORE INDEX and VIEW +ERROR HY000: Incorrect usage of index hints and VIEW DROP VIEW v1; DROP TABLE t1; End of 5.0 tests. diff --git a/sql/sql_view.cc b/sql/sql_view.cc index c1149ab63b9..9e16a5e31ee 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -953,12 +953,9 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, DBUG_RETURN(0); } - if (table->use_index || table->ignore_index) + if (table->index_hints && table->index_hints->elements) { - my_error(ER_WRONG_USAGE, MYF(0), - table->ignore_index ? "IGNORE INDEX" : - (table->force_index ? "FORCE INDEX" : "USE INDEX"), - "VIEW"); + my_error(ER_WRONG_USAGE, MYF(0), "index hints", "VIEW"); DBUG_RETURN(TRUE); }