summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorantony@ppcg5.local <>2007-06-28 13:36:26 -0700
committerantony@ppcg5.local <>2007-06-28 13:36:26 -0700
commitb0b0b0fbc4c679f0ae9e0159ad26eb49ae484ab3 (patch)
treeda2f7e222273c732b24ff4cef082448d41d7eb73 /sql/sql_insert.cc
parentb3e29fbd1de8a067ad5994775f870d76ef2f84e7 (diff)
downloadmariadb-git-b0b0b0fbc4c679f0ae9e0159ad26eb49ae484ab3.tar.gz
Bug#25511
"Federated INSERT failures" Federated does not correctly handle "INSERT...ON DUPLICATE KEY UPDATE" However, implementing such support is not reasonably possible without increasing complexity of the storage engine: checking that constraints on remote server match local server and parsing error messages. This patch causes 'ON DUPLICATE KEY' to fail with ER_DUP_KEY message if a conflict occurs and not to fail silently.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 228fc8860ae..3bfd84b324b 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -715,6 +715,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
*/
table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
}
+ if (duplic == DUP_UPDATE)
+ table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
/*
let's *try* to start bulk inserts. It won't necessary
start them as values_list.elements should be greater than
@@ -2434,6 +2436,8 @@ bool Delayed_insert::handle_inserts(void)
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
using_opt_replace= 1;
}
+ if (info.handle_duplicates == DUP_UPDATE)
+ table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
thd.clear_error(); // reset error for binlog
if (write_record(&thd, table, &info))
{
@@ -2761,6 +2765,8 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
}
+ if (info.handle_duplicates == DUP_UPDATE)
+ table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= (!info.ignore &&
(thd->variables.sql_mode &
@@ -3218,6 +3224,8 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
}
+ if (info.handle_duplicates == DUP_UPDATE)
+ table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
if (!thd->prelocked_mode)
table->file->start_bulk_insert((ha_rows) 0);
thd->no_trans_update.stmt= FALSE;