1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Fixed LP bug #944782.

This bug in the function JOIN::drop_unused_derived_keys() could
leave the internal structures for a materialized derived table
in an inconsistent state. This led to a not quite correct EXPLAIN
output when no additional key had been created to access the table.
It also may lead to more serious consequences: so, the test case
added with this fix caused a crash in mariadb-5.5.20.
This commit is contained in:
Igor Babaev
2012-03-04 22:38:17 -08:00
parent 000deedf3b
commit 6f3c39a057
4 changed files with 77 additions and 6 deletions

View File

@@ -8712,8 +8712,13 @@ void JOIN::drop_unused_derived_keys()
continue;
if (table->max_keys > 1)
table->use_index(tab->ref.key);
if (table->s->keys && tab->ref.key >= 0)
tab->ref.key= 0;
if (table->s->keys)
{
if (tab->ref.key >= 0)
tab->ref.key= 0;
else
table->s->keys= 0;
}
tab->keys= (key_map) (table->s->keys ? 1 : 0);
}
}