diff options
author | Konstantin Osipov <kostja@sun.com> | 2009-12-15 22:03:56 +0300 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2009-12-15 22:03:56 +0300 |
commit | 5e57d0916c3adefee12e6e37eb384bac54bda954 (patch) | |
tree | 3a91a2807267fcf278aa0b222b78ec3fb5e2d4c7 /sql/sql_insert.cc | |
parent | 7a6e5c3f4cbbfeabd370e074ad03fb7dae90b964 (diff) | |
parent | 31c1efdb327fcfc4c601fb6698f8732f154948a4 (diff) | |
download | mariadb-git-5e57d0916c3adefee12e6e37eb384bac54bda954.tar.gz |
Merge next-mr -> next-4284.
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 9a351085b3a..b108ff75f44 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1333,6 +1333,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; |