summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-05-11 03:17:05 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-05-11 03:17:05 +0500
commit361905687e473a71083c5d3c69f3b939943cce7c (patch)
tree2a5e5eab8d8320caa2167e039b0e9d304ef309af /sql/sql_insert.cc
parent184cc3b5fa723e81236c34a2e60c1b5fc0a37406 (diff)
downloadmariadb-git-361905687e473a71083c5d3c69f3b939943cce7c.tar.gz
Fixed bug #28000.
Bug occurs in INSERT IGNORE ... SELECT ... ON DUPLICATE KEY UPDATE statements, when SELECT returns duplicated values and UPDATE clause tries to assign NULL values to NOT NULL fields. NOTE: By current design MySQL server treats INSERT IGNORE ... ON DUPLICATE statements as INSERT ... ON DUPLICATE with update of duplicated records, but MySQL manual lacks this information. After this fix such behaviour becomes legalized. The write_record() function was returning error values even within INSERT IGNORE, because ignore_errors parameter of the fill_record_n_invoke_before_triggers() function call was always set to FALSE. FALSE is replaced by info->ignore. sql/sql_insert.cc: Fixed bug #28000: The write_record() function was returning error values even within INSERT IGNORE, because ignore_errors parameter of the fill_record_n_invoke_before_triggers() function call was always set to FALSE. FALSE is replaced by info->ignore. mysql-test/t/insert_update.test: Added test case for bug #28000. mysql-test/r/insert_update.result: Added test case for bug #28000.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index f1d86224adb..5f54bc2b43b 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1258,7 +1258,8 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
DBUG_ASSERT(info->update_fields->elements ==
info->update_values->elements);
if (fill_record_n_invoke_before_triggers(thd, *info->update_fields,
- *info->update_values, 0,
+ *info->update_values,
+ info->ignore,
table->triggers,
TRG_EVENT_UPDATE))
goto before_trg_err;