mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge dator5.(none):/home/pappa/clean-mysql-5.1
into dator5.(none):/home/pappa/bug17138 mysql-test/r/partition.result: Auto merged mysql-test/t/partition.test: Auto merged sql/sql_insert.cc: Auto merged sql/sql_table.cc: Auto merged
This commit is contained in:
@ -976,12 +976,21 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
||||
while ((error=table->file->ha_write_row(table->record[0])))
|
||||
{
|
||||
uint key_nr;
|
||||
if (error != HA_WRITE_SKIP)
|
||||
bool is_duplicate_key_error;
|
||||
if (table->file->is_fatal_error(error, HA_CHECK_DUPP))
|
||||
goto err;
|
||||
table->file->restore_auto_increment(); // it's too early here! BUG#20188
|
||||
is_duplicate_key_error= table->file->is_fatal_error(error, 0);
|
||||
if (!is_duplicate_key_error)
|
||||
{
|
||||
if (info->ignore)
|
||||
goto ok_or_after_trg_err;
|
||||
else
|
||||
goto err;
|
||||
}
|
||||
if ((int) (key_nr = table->file->get_dup_key(error)) < 0)
|
||||
{
|
||||
error=HA_WRITE_SKIP; /* Database can't find key */
|
||||
error=HA_ERR_FOUND_DUPP_KEY; /* Database can't find key */
|
||||
goto err;
|
||||
}
|
||||
/* Read all columns for the row we are going to replace */
|
||||
@ -1062,7 +1071,8 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
||||
if ((error=table->file->ha_update_row(table->record[1],
|
||||
table->record[0])))
|
||||
{
|
||||
if ((error == HA_ERR_FOUND_DUPP_KEY) && info->ignore)
|
||||
if (info->ignore &&
|
||||
!table->file->is_fatal_error(error, HA_CHECK_DUPP_KEY))
|
||||
goto ok_or_after_trg_err;
|
||||
goto err;
|
||||
}
|
||||
@ -1145,7 +1155,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
||||
else if ((error=table->file->ha_write_row(table->record[0])))
|
||||
{
|
||||
if (!info->ignore ||
|
||||
(error != HA_ERR_FOUND_DUPP_KEY && error != HA_ERR_FOUND_DUPP_UNIQUE))
|
||||
table->file->is_fatal_error(error, HA_CHECK_DUPP))
|
||||
goto err;
|
||||
table->file->restore_auto_increment();
|
||||
goto ok_or_after_trg_err;
|
||||
|
Reference in New Issue
Block a user