1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

select.result, select.test:

Added a test case for bug #5333.
null_key.result, key_primary.result:
  Made covering index usable for const tables.
sql_select.cc:
  Made covering index usable for const tables:
  downported the corresponding code from 4.1.
  Simultaneously fixed bug #5333 reported for 4.1.
  The bug was due to the fact that field index in join
  structures was always set to 0 for const tables.
This commit is contained in:
igor@rurik.mysql.com
2004-09-02 22:06:30 -07:00
parent 4b760fcb94
commit f888026fdc
5 changed files with 49 additions and 3 deletions

View File

@ -4901,6 +4901,15 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
}
else
{
if (!table->key_read &&
(table->used_keys & ((key_map) 1 << tab->ref.key)) &&
!table->no_keyread &&
(int) table->reginfo.lock_type <= (int) TL_READ_HIGH_PRIORITY)
{
table->key_read=1;
table->file->extra(HA_EXTRA_KEYREAD);
tab->index= tab->ref.key;
}
if ((error=join_read_const(tab)))
{
tab->info="unique row not found";
@ -7617,7 +7626,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
sprintf(buff3,"%.0f",join->best_positions[i].records_read);
item_list.push_back(new Item_string(buff3,strlen(buff3)));
my_bool key_read=table->key_read;
if (tab->type == JT_NEXT &&
if ((tab->type == JT_NEXT || tab->type == JT_CONST) &&
((table->used_keys & ((key_map) 1 << tab->index))))
key_read=1;