summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index c6c31593a5f..867ac7ff778 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1685,7 +1685,14 @@ void handler::restore_auto_increment()
{
THD *thd= table->in_use;
if (thd->next_insert_id)
+ {
thd->next_insert_id= thd->prev_insert_id;
+ if (thd->next_insert_id == 0)
+ {
+ /* we didn't generate a value, engine will be called again */
+ thd->clear_next_insert_id= 0;
+ }
+ }
}