mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
bugfix for MERGE tables and MAX(key)
This commit is contained in:
@ -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);
|
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;
|
select max(b) from t where a = 2;
|
||||||
max(b)
|
max(b)
|
||||||
NULL
|
2
|
||||||
select max(b) from t1 where a = 2;
|
select max(b) from t1 where a = 2;
|
||||||
max(b)
|
max(b)
|
||||||
1
|
1
|
||||||
|
@ -38,7 +38,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
|
|||||||
table_map removed_tables=0;
|
table_map removed_tables=0;
|
||||||
Item *item;
|
Item *item;
|
||||||
COND *org_conds= conds;
|
COND *org_conds= conds;
|
||||||
|
|
||||||
/* Add all ON conditions to WHERE condition */
|
/* Add all ON conditions to WHERE condition */
|
||||||
for (TABLE_LIST *tl=tables; tl ; tl= tl->next)
|
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;
|
error=table->file->index_last(table->record[0]) !=0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(void)table->file->index_read(table->record[0], key_buff,
|
error = table->file->index_read(table->record[0], key_buff,
|
||||||
ref.key_length,
|
ref.key_length,
|
||||||
HA_READ_AFTER_KEY);
|
HA_READ_PREFIX_LAST) ||
|
||||||
error=table->file->index_prev(table->record[0]) ||
|
|
||||||
key_cmp(table,key_buff,ref.key,ref.key_length);
|
key_cmp(table,key_buff,ref.key,ref.key_length);
|
||||||
}
|
}
|
||||||
if (table->key_read)
|
if (table->key_read)
|
||||||
|
Reference in New Issue
Block a user