mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-24346 valgrind error in main.precedence
in queries like create view v1 as select 2 like 1 escape (3 in (select 0 union select 1)); select 2 union select * from v1; Item_func_like::escape was left uninitialized, because Item_in_optimizer is const_during_execution() but not actually const_item() during execution. It's not, because const subquery evaluation was disabled for derived. Practically it only needs to be disabled for multi-update that runs fix_fields() before all tables are locked.
This commit is contained in:
@@ -1534,7 +1534,11 @@ int mysql_multi_update_prepare(THD *thd)
|
||||
During prepare phase acquire only S metadata locks instead of SW locks to
|
||||
keep prepare of multi-UPDATE compatible with concurrent LOCK TABLES WRITE
|
||||
and global read lock.
|
||||
|
||||
Don't evaluate any subqueries even if constant, because
|
||||
tables aren't locked yet.
|
||||
*/
|
||||
lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_DERIVED;
|
||||
if (thd->lex->sql_command == SQLCOM_UPDATE_MULTI)
|
||||
{
|
||||
if (open_tables(thd, &table_list, &table_count,
|
||||
@@ -1557,6 +1561,9 @@ int mysql_multi_update_prepare(THD *thd)
|
||||
{
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_DERIVED;
|
||||
|
||||
(void) read_statistics_for_tables_if_needed(thd, table_list);
|
||||
/* @todo: downgrade the metadata locks here. */
|
||||
|
||||
|
Reference in New Issue
Block a user