diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index cc69762cbdb..20837e2172d 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -5051,7 +5051,8 @@ ha_innobase::external_lock( if (prebuilt->select_lock_type != LOCK_NONE) { if (thd->in_lock_tables && - thd->variables.innodb_table_locks) { + thd->variables.innodb_table_locks && + (thd->options & OPTION_NOT_AUTOCOMMIT)) { ulint error; error = row_lock_table_for_mysql(prebuilt, NULL, LOCK_TABLE_EXP);