mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge 10.4 into 10.5
This commit is contained in:
@ -1036,10 +1036,16 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables)
|
||||
|
||||
if (vers_conditions.is_set())
|
||||
{
|
||||
if (vers_conditions.was_set() &&
|
||||
table->lock_type > TL_READ_NO_INSERT &&
|
||||
!vers_conditions.delete_history)
|
||||
{
|
||||
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), table->alias.str);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
if (vers_conditions.type == SYSTEM_TIME_ALL)
|
||||
continue;
|
||||
|
||||
lock_type= TL_READ; // ignore TL_WRITE, history is immutable anyway
|
||||
}
|
||||
|
||||
bool timestamps_only= table->table->versioned(VERS_TIMESTAMP);
|
||||
@ -2768,11 +2774,16 @@ int JOIN::optimize_stage2()
|
||||
}
|
||||
|
||||
need_tmp= test_if_need_tmp_table();
|
||||
//TODO this could probably go in test_if_need_tmp_table.
|
||||
if (this->select_lex->window_specs.elements > 0) {
|
||||
need_tmp= TRUE;
|
||||
|
||||
/*
|
||||
If window functions are present then we can't have simple_order set to
|
||||
TRUE as the window function needs a temp table for computation.
|
||||
ORDER BY is computed after the window function computation is done, so
|
||||
the sort will be done on the temp table.
|
||||
*/
|
||||
if (select_lex->have_window_funcs())
|
||||
simple_order= FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
If the hint FORCE INDEX FOR ORDER BY/GROUP BY is used for the table
|
||||
|
Reference in New Issue
Block a user