diff options
-rw-r--r-- | mysql-test/include/common-tests.inc | 4 | ||||
-rw-r--r-- | mysql-test/r/compress.result | 4 | ||||
-rw-r--r-- | mysql-test/r/key_cache.result | 2 | ||||
-rw-r--r-- | mysql-test/r/preload.result | 2 | ||||
-rw-r--r-- | mysql-test/r/select.result | 14 | ||||
-rw-r--r-- | mysql-test/r/view.result | 2 | ||||
-rw-r--r-- | mysql-test/t/view.test | 2 | ||||
-rw-r--r-- | sql/sql_base.cc | 3 |
8 files changed, 22 insertions, 11 deletions
diff --git a/mysql-test/include/common-tests.inc b/mysql-test/include/common-tests.inc index 46d0182d17f..882ac689498 100644 --- a/mysql-test/include/common-tests.inc +++ b/mysql-test/include/common-tests.inc @@ -1296,9 +1296,9 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; # The next should give an error # --- error 1072 +-- error 1176 explain select fld3 from t2 ignore index (fld3,not_used); --- error 1072 +-- error 1176 explain select fld3 from t2 use index (not_used); # diff --git a/mysql-test/r/compress.result b/mysql-test/r/compress.result index efcafbbe736..cce66fd84ef 100644 --- a/mysql-test/r/compress.result +++ b/mysql-test/r/compress.result @@ -145,9 +145,9 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3,not_used); -ERROR 42000: Key column 'not_used' doesn't exist in table +ERROR HY000: Key 'not_used' doesn't exist in table 't2' explain select fld3 from t2 use index (not_used); -ERROR 42000: Key column 'not_used' doesn't exist in table +ERROR HY000: Key 'not_used' doesn't exist in table 't2' select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; fld3 honeysuckle diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result index d578d5697f2..406a92b9a08 100644 --- a/mysql-test/r/key_cache.result +++ b/mysql-test/r/key_cache.result @@ -194,7 +194,7 @@ Table Op Msg_type Msg_text test.t1 assign_to_keycache error Key 'unknown_key' doesn't exist in table 't1' test.t1 assign_to_keycache status Operation failed Warnings: -Error 1072 Key column 'unknown_key' doesn't exist in table +Error 1176 Key 'unknown_key' doesn't exist in table 't1' select @@keycache2.key_buffer_size; @@keycache2.key_buffer_size 4194304 diff --git a/mysql-test/r/preload.result b/mysql-test/r/preload.result index 0c5b54883fc..145fd22ffb6 100644 --- a/mysql-test/r/preload.result +++ b/mysql-test/r/preload.result @@ -164,7 +164,7 @@ test.t2 preload_keys error Key 'c' doesn't exist in table 't2' test.t2 preload_keys status Operation failed Warnings: Error 1146 Table 'test.t3' doesn't exist -Error 1072 Key column 'c' doesn't exist in table +Error 1176 Key 'c' doesn't exist in table 't2' show status like "key_read%"; Variable_name Value Key_read_requests 0 diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 335637b787f..86e1a8ada19 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -144,9 +144,9 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3,not_used); -ERROR 42000: Key column 'not_used' doesn't exist in table +ERROR HY000: Key 'not_used' doesn't exist in table 't2' explain select fld3 from t2 use index (not_used); -ERROR 42000: Key column 'not_used' doesn't exist in table +ERROR HY000: Key 'not_used' doesn't exist in table 't2' select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; fld3 honeysuckle @@ -2716,6 +2716,16 @@ select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 fro f1 f2 1 1 drop table t1,t2; +CREATE TABLE t1 (a int, INDEX idx(a)); +INSERT INTO t1 VALUES (2), (3), (1); +EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +EXPLAIN SELECT * FROM t1 IGNORE INDEX (a); +ERROR HY000: Key 'a' doesn't exist in table 't1' +EXPLAIN SELECT * FROM t1 FORCE INDEX (a); +ERROR HY000: Key 'a' doesn't exist in table 't1' +DROP TABLE t1; CREATE TABLE t1 ( city char(30) ); INSERT INTO t1 VALUES ('London'); INSERT INTO t1 VALUES ('Paris'); diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 2aab169ba76..5bb407f4256 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -614,7 +614,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 column 'some_index' doesn't exist in table +ERROR HY000: Key 'some_index' doesn't exist in table 'v1' drop view v1; drop table t1; create table t1 (col1 char(5),col2 char(5)); diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 0e8cea41a1f..a1c1e9b2ad1 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -516,7 +516,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 1072 +-- error 1176 select b from v1 use index (some_index) where b=1; drop view v1; drop table t1; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index e9a3953d981..1e715bff249 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4441,6 +4441,7 @@ bool setup_tables(THD *thd, Name_resolution_context *context, table_list= table_list->next_leaf, tablenr++) { TABLE *table= table_list->table; + table->pos_in_table_list= table_list; if (first_select_table && table_list->top_table() == first_select_table) { @@ -4585,7 +4586,7 @@ bool get_key_map_from_key_list(key_map *map, TABLE *table, 0) { my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), name->c_ptr(), - table->s->table_name); + table->pos_in_table_list->alias); map->set_all(); return 1; } |