Fix for BUG#31035: select from function, group by result crasher.
This actually, fix for the patch for bug-27354. The problem with the patch was that Item_func_sp::used_tables() was updated, but Item_func_sp::const_item() was not. So, for Item_func_sp, we had the following inconsistency: - used_tables() returned RAND_TABLE, which means that the item can produce "random" results; - but const_item() returned TRUE, which means that the item is a constant one. The fix is to change Item_func_sp::const_item() behaviour: it must return TRUE (an item is a constant one) only if a stored function is deterministic and each of its arguments (if any) is a constant item. mysql-test/r/sp.result: Update result file. mysql-test/t/sp.test: Add test cases for BUG-31035, BUG-31191, BUG-31226 sql/item_func.cc: Make Item::const_item() be consistent with Item::used_tables().
Showing
Please register or sign in to comment