Commit dbb95326 authored by hf@deer.(none)'s avatar hf@deer.(none)

Proposed fix for #751

Fields in key_expr (mysql_ha_read) wasn't linked to tables.
Hmm. How did it work at all?
parent b2769e27
...@@ -70,3 +70,4 @@ INSERT INTO t1 VALUES ('40004712','000001','0020',0); ...@@ -70,3 +70,4 @@ INSERT INTO t1 VALUES ('40004712','000001','0020',0);
UPDATE t1 SET t1.xstatus_vor = Greatest(t1.xstatus_vor,1) WHERE t1.aufnr = UPDATE t1 SET t1.xstatus_vor = Greatest(t1.xstatus_vor,1) WHERE t1.aufnr =
"40004712" AND t1.plnfl = "000001" AND t1.vornr > "0010" ORDER BY t1.vornr "40004712" AND t1.plnfl = "000001" AND t1.vornr > "0010" ORDER BY t1.vornr
ASC LIMIT 1; ASC LIMIT 1;
drop table t1;
...@@ -146,3 +146,9 @@ alter table t1 type=MyISAM; ...@@ -146,3 +146,9 @@ alter table t1 type=MyISAM;
handler t2 read first; handler t2 read first;
Unknown table 't2' in HANDLER Unknown table 't2' in HANDLER
drop table t1; drop table t1;
create table t1(a int, index(a));
insert into t1 values (1), (2), (3);
handler t1 open;
handler t1 read a=(W);
Unknown column 'W' in 'field list'
drop table t1;
...@@ -81,3 +81,5 @@ INSERT INTO t1 VALUES ('40004712','000001','0020',0); ...@@ -81,3 +81,5 @@ INSERT INTO t1 VALUES ('40004712','000001','0020',0);
UPDATE t1 SET t1.xstatus_vor = Greatest(t1.xstatus_vor,1) WHERE t1.aufnr = UPDATE t1 SET t1.xstatus_vor = Greatest(t1.xstatus_vor,1) WHERE t1.aufnr =
"40004712" AND t1.plnfl = "000001" AND t1.vornr > "0010" ORDER BY t1.vornr "40004712" AND t1.plnfl = "000001" AND t1.vornr > "0010" ORDER BY t1.vornr
ASC LIMIT 1; ASC LIMIT 1;
drop table t1;
...@@ -80,3 +80,13 @@ alter table t1 type=MyISAM; ...@@ -80,3 +80,13 @@ alter table t1 type=MyISAM;
handler t2 read first; handler t2 read first;
drop table t1; drop table t1;
#
#test for #751
#
create table t1(a int, index(a));
insert into t1 values (1), (2), (3);
handler t1 open;
--error 1054
handler t1 read a=(W);
drop table t1;
...@@ -193,6 +193,8 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, ...@@ -193,6 +193,8 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
Item *item; Item *item;
for (key_len=0 ; (item=it_ke++) ; key_part++) for (key_len=0 ; (item=it_ke++) ; key_part++)
{ {
if (item->fix_fields(thd, tables))
return -1;
item->save_in_field(key_part->field, 1); item->save_in_field(key_part->field, 1);
key_len+=key_part->store_length; key_len+=key_part->store_length;
} }
......
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