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

Bug #20466: a view is mixing data when there's a trigger on the table

When making a place to store field values at the start of each group
  the real item (not the reference) must be used when deciding which column
  to copy.
This commit is contained in:
gkodinov/kgeorge@macbook.mshome.net
2006-07-21 20:44:35 +03:00
parent 8b7fc77a0f
commit 0282028292
3 changed files with 57 additions and 7 deletions

View File

@ -13066,10 +13066,11 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
param->copy_funcs.empty();
for (i= 0; (pos= li++); i++)
{
if (pos->real_item()->type() == Item::FIELD_ITEM)
Item *real_pos= pos->real_item();
if (real_pos->type() == Item::FIELD_ITEM)
{
Item_field *item;
pos= pos->real_item();
pos= real_pos;
if (!(item= new Item_field(thd, ((Item_field*) pos))))
goto err;
pos= item;
@ -13108,12 +13109,13 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
}
}
}
else if ((pos->type() == Item::FUNC_ITEM ||
pos->type() == Item::SUBSELECT_ITEM ||
pos->type() == Item::CACHE_ITEM ||
pos->type() == Item::COND_ITEM) &&
!pos->with_sum_func)
else if ((real_pos->type() == Item::FUNC_ITEM ||
real_pos->type() == Item::SUBSELECT_ITEM ||
real_pos->type() == Item::CACHE_ITEM ||
real_pos->type() == Item::COND_ITEM) &&
!real_pos->with_sum_func)
{ // Save for send fields
pos= real_pos;
/* TODO:
In most cases this result will be sent to the user.
This should be changed to use copy_int or copy_real depending