1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-6997: SET STATEMENT last_insert_id FOR ... does not affect the value written to the binlog

Problem was in reinitialization of first_successful_insert_id_in_prev_stmt_for_binlog after setting variables.
This commit is contained in:
Oleksandr Byelkin
2015-03-13 16:32:47 +01:00
parent 197afb413f
commit 41106b229e
6 changed files with 167 additions and 5 deletions

View File

@ -2743,6 +2743,18 @@ mysql_execute_command(THD *thd)
lex->restore_set_statement_var();
goto error;
}
/*
The value of last_insert_id is remembered in THD to be written to binlog
when it's used *the first time* in the statement. But SET STATEMENT
must read the old value of last_insert_id to be able to restore it at
the end. This should not count at "reading of last_insert_id" and
should not remember last_insert_id for binlog. That is, it should clear
stmt_depends_on_first_successful_insert_id_in_prev_stmt flag.
*/
if (!thd->in_sub_stmt)
{
thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
}
}
if (thd->lex->mi.connection_name.str == NULL)