mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +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:
@ -357,6 +357,14 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived)
|
||||
if (derived->merged)
|
||||
return FALSE;
|
||||
|
||||
if (dt_select->uncacheable & UNCACHEABLE_RAND)
|
||||
{
|
||||
/* There is random function => fall back to materialization. */
|
||||
derived->change_refs_to_fields();
|
||||
derived->set_materialized_derived();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (thd->lex->sql_command == SQLCOM_UPDATE_MULTI ||
|
||||
thd->lex->sql_command == SQLCOM_DELETE_MULTI)
|
||||
thd->save_prep_leaf_list= TRUE;
|
||||
|
Reference in New Issue
Block a user