* Gleb Shchepa <gshchepa@stripped> [08/10/07 16:05]:
> 2689 Gleb Shchepa 2008-10-07
> Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
> ``FLUSH TABLES WITH READ LOCK''
>
> Concurrent execution of 1) multitable update with a
> NATURAL/USING join and 2) a such query as "FLUSH TABLES
> WITH READ LOCK" or "ALTER TABLE" of updating table led
> to a server crash.
>
>
> The mysql_multi_update_prepare() function call is optimized
> to lock updating tables only, so it postpones locking to
> the last, and if locking fails, it does cleanup of modified
> syntax structures and repeats a query analysis. However,
> that cleanup procedure was incomplete for NATURAL/USING join
> syntax data: 1) some Field_item items pointed into freed
> table structures, and 2) the TABLE_LIST::join_columns fields
> was not reset.
>
> Major change:
> short-living Field *Natural_join_column::table_field has
> been replaced with long-living Item*.
Please add select_lex::first_natural_join_processing and use/set
it explicitly in setup_natural_join_row_types() instead of adding
thd->multiupdate_reopen and checking it in
setup_natural_join_row_types().
It's okay to push this patch with this change.
--