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

Fixed LP bug #874006.

This bug manifested itself with queries containing non-correlated
IN subqueries over materialized views/derived tables.  
The bug happened because the code of the function generate_derived_keys did
not take into account that the function could be called twice when the
optimizer was deciding whether in-exist transformation should be applied.
This commit is contained in:
Igor Babaev
2011-10-16 13:23:57 -07:00
parent 5e4a381cc5
commit f5955f87c6
4 changed files with 113 additions and 17 deletions

View File

@ -5220,10 +5220,11 @@ void st_table::mark_virtual_columns_for_write(bool insert_fl)
@brief
Allocate space for keys
@param key_count number of keys to allocate
@param key_count number of keys to allocate additionally
@details
The function allocates memory to fit 'key_count' keys for this table.
The function allocates memory to fit additionally 'key_count' keys
for this table.
@return FALSE space was successfully allocated
@return TRUE an error occur
@ -5231,9 +5232,11 @@ void st_table::mark_virtual_columns_for_write(bool insert_fl)
bool TABLE::alloc_keys(uint key_count)
{
key_info= s->key_info= (KEY*) alloc_root(&mem_root, sizeof(KEY)*key_count);
s->keys= 0;
max_keys= key_count;
key_info= (KEY*) alloc_root(&mem_root, sizeof(KEY)*(s->keys+key_count));
if (s->keys)
memmove(key_info, s->key_info, sizeof(KEY)*s->keys);
s->key_info= key_info;
max_keys= s->keys+key_count;
return !(key_info);
}