diff options
author | Sergey Vojtovich <svoj@sun.com> | 2009-12-09 15:03:34 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@sun.com> | 2009-12-09 15:03:34 +0400 |
commit | cda5ad508ae591c3d73c5316eb68e024e5ebd7c4 (patch) | |
tree | 5732512e67d66255eba1c3b512ef545d714c9795 /sql/sql_insert.cc | |
parent | 6fd3866c6c104f8bc991d71583e627ae6fabe0ab (diff) | |
parent | 6b8cd32eaa0e4bcbe2e5031cbb465f6a6036bc58 (diff) | |
download | mariadb-git-cda5ad508ae591c3d73c5316eb68e024e5ebd7c4.tar.gz |
Merge mysql-next-mr to mysql-next-mr-svoj.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index efdc8caa3e5..1179e2ec182 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1322,6 +1322,23 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, static int last_uniq_key(TABLE *table,uint keynr) { + /* + When an underlying storage engine informs that the unique key + conflicts are not reported in the ascending order by setting + the HA_DUPLICATE_KEY_NOT_IN_ORDER flag, we cannot rely on this + information to determine the last key conflict. + + The information about the last key conflict will be used to + do a replace of the new row on the conflicting row, rather + than doing a delete (of old row) + insert (of new row). + + Hence check for this flag and disable replacing the last row + by returning 0 always. Returning 0 will result in doing + a delete + insert always. + */ + if (table->file->ha_table_flags() & HA_DUPLICATE_KEY_NOT_IN_ORDER) + return 0; + while (++keynr < table->s->keys) if (table->key_info[keynr].flags & HA_NOSAME) return 0; |