diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-04-20 15:25:55 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-04-20 15:25:55 +0200 |
commit | b069d19284b70ead3ceb62618acdc8ef93a2703e (patch) | |
tree | 0d5f6764825d51db3b8a37c8043d837c06e3e086 /sql/sql_insert.cc | |
parent | 1bc0b0b5245977172e2c3a3c64a42a2c4e762e06 (diff) | |
parent | e7061f7e5a96c66cb2e0bf46bec7f6ff35801a69 (diff) | |
download | mariadb-git-b069d19284b70ead3ceb62618acdc8ef93a2703e.tar.gz |
Merge branch 'mysql/5.5' into 5.5
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index a089f5202aa..7e3a898b3da 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1,6 +1,6 @@ /* - Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2015, MariaDB + Copyright (c) 2000, 2016, Oracle and/or its affiliates. + Copyright (c) 2010, 2016, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1609,7 +1609,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) else table->file->insert_id_for_cur_row= insert_id_for_cur_row; bool is_duplicate_key_error; - if (table->file->is_fatal_error(error, HA_CHECK_DUP)) + if (table->file->is_fatal_error(error, HA_CHECK_DUP | HA_CHECK_FK_ERROR)) goto err; is_duplicate_key_error= table->file->is_fatal_error(error, 0); if (!is_duplicate_key_error) @@ -1712,7 +1712,8 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) error != HA_ERR_RECORD_IS_THE_SAME) { if (info->ignore && - !table->file->is_fatal_error(error, HA_CHECK_DUP_KEY)) + !table->file->is_fatal_error(error, HA_CHECK_DUP_KEY | + HA_CHECK_FK_ERROR)) { if (!(thd->variables.old_behavior & OLD_MODE_NO_DUP_KEY_WARNINGS_WITH_IGNORE)) @@ -1844,7 +1845,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) { DEBUG_SYNC(thd, "write_row_noreplace"); if (!info->ignore || - table->file->is_fatal_error(error, HA_CHECK_DUP)) + table->file->is_fatal_error(error, HA_CHECK_DUP | HA_CHECK_FK_ERROR)) goto err; if (!(thd->variables.old_behavior & OLD_MODE_NO_DUP_KEY_WARNINGS_WITH_IGNORE)) @@ -1865,6 +1866,9 @@ ok_or_after_trg_err: my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH); if (!table->file->has_transactions()) thd->transaction.stmt.modified_non_trans_table= TRUE; + if (info->ignore && + !table->file->is_fatal_error(error, HA_CHECK_FK_ERROR)) + warn_fk_constraint_violation(thd, table, error); DBUG_RETURN(trg_error); err: |