merging bug 28701 to 5.1-opt

parent eb009402
...@@ -625,7 +625,7 @@ drop table t1; ...@@ -625,7 +625,7 @@ drop table t1;
create table t1 (a int, b int); create table t1 (a int, b int);
create view v1 as select a, sum(b) from t1 group by a; create view v1 as select a, sum(b) from t1 group by a;
select b from v1 use index (some_index) where b=1; 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 view v1;
drop table t1; drop table t1;
create table t1 (col1 char(5),col2 char(5)); create table t1 (col1 char(5),col2 char(5));
...@@ -3563,11 +3563,11 @@ CREATE TABLE t1 (a INT); ...@@ -3563,11 +3563,11 @@ CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2); INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM v1 USE KEY(non_existant); 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); 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); 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 VIEW v1;
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests. End of 5.0 tests.
......
...@@ -953,12 +953,9 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, ...@@ -953,12 +953,9 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
DBUG_RETURN(0); 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), my_error(ER_WRONG_USAGE, MYF(0), "index hints", "VIEW");
table->ignore_index ? "IGNORE INDEX" :
(table->force_index ? "FORCE INDEX" : "USE INDEX"),
"VIEW");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment