1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

MDEV-5414: RAND() in a subselect : different behavior in MariaDB and MySQL

Materialization forced in case if rand() used in view or derived table to avoud several calls of rand for gting value of a field.

Fixed set variable uncachable flag from - it shouldbe a side effect not a random value.
This commit is contained in:
unknown
2013-12-18 15:59:51 +02:00
parent 3ec4296ec4
commit 57400ee681
8 changed files with 261 additions and 3 deletions

View File

@@ -2340,7 +2340,9 @@ bool st_lex::can_be_merged()
// TODO: do not forget implement case when select_lex.table_list.elements==0
/* find non VIEW subqueries/unions */
bool selects_allow_merge= select_lex.next_select() == 0;
bool selects_allow_merge= (select_lex.next_select() == 0 &&
!(select_lex.uncacheable &
UNCACHEABLE_RAND));
if (selects_allow_merge)
{
for (SELECT_LEX_UNIT *tmp_unit= select_lex.first_inner_unit();