1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were

inserted.

The select_insert::send_eof() function now resets LAST_INSERT_ID variable if
no rows were inserted.


mysql-test/t/insert_select.test:
  Added a test case for bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were inserted.
mysql-test/r/insert_select.result:
  Added a test case for bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were inserted.
sql/sql_insert.cc:
  Bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were
  inserted.The select_insert::send_eof() function now resets LAST_INSERT_ID variable if
  no rows were inserted.
This commit is contained in:
unknown
2007-02-09 22:25:09 +03:00
parent d4b4952f8b
commit dd6feec4f4
3 changed files with 28 additions and 1 deletions

View File

@ -2630,7 +2630,7 @@ bool select_insert::send_eof()
}
if (last_insert_id)
thd->insert_id(last_insert_id); // For binary log
thd->insert_id(info.copied ? last_insert_id : 0); // For binary log
/* Write to binlog before commiting transaction */
if (mysql_bin_log.is_open())
{