Commit 7a62b592 authored by unknown's avatar unknown
Browse files

Fix for BUG#12082 (assert failure when the query fails to get a lock for record in 'const' table):

 Set table->key_read back to 0 regardless of whether join_read_const() succeeded or not.

parent 8db171df
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -9717,7 +9717,13 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
      table->file->extra(HA_EXTRA_KEYREAD);
      tab->index= tab->ref.key;
    }
    if ((error=join_read_const(tab)))
    error=join_read_const(tab);
    if (table->key_read)
    {
      table->key_read=0;
      table->file->extra(HA_EXTRA_NO_KEYREAD);
    }
    if (error)
    {
      tab->info="unique row not found";
      /* Mark for EXPLAIN that the row was not found */
@@ -9725,11 +9731,6 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
      if (!table->maybe_null || error > 0)
	DBUG_RETURN(error);
    }
    if (table->key_read)
    {
      table->key_read=0;
      table->file->extra(HA_EXTRA_NO_KEYREAD);
    }
  }
  if (*tab->on_expr_ref && !table->null_row)
  {