diff options
author | unknown <serg@serg.mysql.com> | 2003-01-17 12:48:23 +0100 |
---|---|---|
committer | unknown <serg@serg.mysql.com> | 2003-01-17 12:48:23 +0100 |
commit | 22b693d80b9ee7a763ae3fa6d33a94e01bb7616d (patch) | |
tree | dd0b99625dd290258e67a9dceab71e771142c48d | |
parent | ef3091541e34703138e1c9f2fa5037faefaf20ba (diff) | |
download | mariadb-git-22b693d80b9ee7a763ae3fa6d33a94e01bb7616d.tar.gz |
bugfix for MERGE tables and MAX(key)
-rw-r--r-- | mysql-test/r/merge.result | 2 | ||||
-rw-r--r-- | sql/opt_sum.cc | 7 |
2 files changed, 4 insertions, 5 deletions
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 86586d5950d..0bffc93c284 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -536,7 +536,7 @@ INSERT INTO t2 VALUES (1,2), (2,2); CREATE TABLE t ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); select max(b) from t where a = 2; max(b) -NULL +2 select max(b) from t1 where a = 2; max(b) 1 diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 4b6a196051e..ecfa97586e9 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -38,7 +38,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) table_map removed_tables=0; Item *item; COND *org_conds= conds; - + /* Add all ON conditions to WHERE condition */ for (TABLE_LIST *tl=tables; tl ; tl= tl->next) { @@ -165,10 +165,9 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) error=table->file->index_last(table->record[0]) !=0; else { - (void)table->file->index_read(table->record[0], key_buff, + error = table->file->index_read(table->record[0], key_buff, ref.key_length, - HA_READ_AFTER_KEY); - error=table->file->index_prev(table->record[0]) || + HA_READ_PREFIX_LAST) || key_cmp(table,key_buff,ref.key,ref.key_length); } if (table->key_read) |