mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix for bug #4508 "CONVERT_TZ() function with new time zone as param crashes server".
Instead of trying to open time zone tables during calculation of CONVERT_TZ() function or setting of @@time_zone variable we should open and lock them with the rest of statement's table (so we should add them to global table list) and after that use such pre-opened tables for loading info about time zones.
This commit is contained in:
@ -1670,7 +1670,22 @@ int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
|
||||
uint counter;
|
||||
if (open_tables(thd, tables, &counter) || lock_tables(thd, tables, counter))
|
||||
DBUG_RETURN(-1); /* purecov: inspected */
|
||||
fix_tables_pointers(thd->lex->all_selects_list);
|
||||
/*
|
||||
Let us propagate pointers to open tables from global table list
|
||||
to table lists in particular selects if needed.
|
||||
*/
|
||||
if (thd->lex->all_selects_list->next_select_in_list() ||
|
||||
thd->lex->time_zone_tables_used)
|
||||
{
|
||||
for (SELECT_LEX *sl= thd->lex->all_selects_list;
|
||||
sl;
|
||||
sl= sl->next_select_in_list())
|
||||
for (TABLE_LIST *cursor= (TABLE_LIST *) sl->table_list.first;
|
||||
cursor;
|
||||
cursor=cursor->next)
|
||||
if (cursor->table_list)
|
||||
cursor->table= cursor->table_list->table;
|
||||
}
|
||||
DBUG_RETURN(mysql_handle_derived(thd->lex));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user