MDEV-7971: Assertion `name != __null' failed in ACL_internal_schema_registry::lookup...

[Attempt #] Make the code that handles "Prepare" phase for multi-table
UPDATE statements handle non-merged semijoins. It can encounter them when
a prepared statement is executed for the second time.
This commit is contained in:
Sergei Petrunia 2015-07-30 14:02:44 +03:00
commit c4456b99b3
5 changed files with 83 additions and 1 deletions

View file

@ -1161,7 +1161,7 @@ bool unsafe_key_update(List<TABLE_LIST> leaves, table_map tables_for_update)
while ((tl= it++))
{
if (tl->table->map & tables_for_update)
if (!tl->is_jtbm() && (tl->table->map & tables_for_update))
{
TABLE *table1= tl->table;
bool primkey_clustered= (table1->file->primary_key_is_clustered() &&
@ -1178,6 +1178,8 @@ bool unsafe_key_update(List<TABLE_LIST> leaves, table_map tables_for_update)
it2.rewind();
while ((tl2= it2++))
{
if (tl2->is_jtbm())
continue;
/*
Look at "next" tables only since all previous tables have
already been checked
@ -1409,6 +1411,9 @@ int mysql_multi_update_prepare(THD *thd)
{
TABLE *table= tl->table;
if (tl->is_jtbm())
continue;
/* if table will be updated then check that it is unique */
if (table->map & tables_for_update)
{
@ -1457,6 +1462,8 @@ int mysql_multi_update_prepare(THD *thd)
for (tl= table_list; tl; tl= tl->next_local)
{
bool not_used= false;
if (tl->is_jtbm())
continue;
if (multi_update_check_table_access(thd, tl, tables_for_update, &not_used))
DBUG_RETURN(TRUE);
}
@ -1464,6 +1471,8 @@ int mysql_multi_update_prepare(THD *thd)
/* check single table update for view compound from several tables */
for (tl= table_list; tl; tl= tl->next_local)
{
if (tl->is_jtbm())
continue;
if (tl->is_merged_derived())
{
TABLE_LIST *for_update= 0;
@ -1493,6 +1502,8 @@ int mysql_multi_update_prepare(THD *thd)
ti.rewind();
while ((tl= ti++))
{
if (tl->is_jtbm())
continue;
TABLE *table= tl->table;
TABLE_LIST *tlist;
if (!(tlist= tl->top_table())->derived)
@ -1635,6 +1646,9 @@ int multi_update::prepare(List<Item> &not_used_values,
*/
while ((table_ref= ti++))
{
if (table_ref->is_jtbm())
continue;
TABLE *table= table_ref->table;
if (tables_to_update & table->map)
{
@ -1654,6 +1668,9 @@ int multi_update::prepare(List<Item> &not_used_values,
ti.rewind();
while ((table_ref= ti++))
{
if (table_ref->is_jtbm())
continue;
TABLE *table= table_ref->table;
if (tables_to_update & table->map)
{
@ -1684,6 +1701,8 @@ int multi_update::prepare(List<Item> &not_used_values,
while ((table_ref= ti++))
{
/* TODO: add support of view of join support */
if (table_ref->is_jtbm())
continue;
TABLE *table=table_ref->table;
leaf_table_count++;
if (tables_to_update & table->map)