From 7bf65299ccb758665d2d265f318085b87a3ff54d Mon Sep 17 00:00:00 2001 From: "sergefp@mysql.com" <> Date: Sun, 31 Jul 2005 02:47:54 +0000 Subject: [PATCH] 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. --- sql/sql_select.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 117e16a2db3..6d3382e3354 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -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) {