diff options
author | Kent Boortz <kent.boortz@oracle.com> | 2011-07-04 01:25:49 +0200 |
---|---|---|
committer | Kent Boortz <kent.boortz@oracle.com> | 2011-07-04 01:25:49 +0200 |
commit | 789aa8c48524d847d103e06b86d2d73539fd7416 (patch) | |
tree | aae7686092aab07db57ff0fe0150741ffbc9689d /sql/sql_update.cc | |
parent | 02e07e3b5195707031dc7399d2a2163b1dfd94a3 (diff) | |
parent | db95a75a4892adedf20e8e9470a7faf6ed4592d7 (diff) | |
download | mariadb-git-789aa8c48524d847d103e06b86d2d73539fd7416.tar.gz |
Updated/added copyright headers
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r-- | sql/sql_update.cc | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc index fc3b8236b72..754170e4c55 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1071,17 +1071,27 @@ bool unsafe_key_update(TABLE_LIST *leaves, table_map tables_for_update) return true; } - if (primkey_clustered && - (bitmap_is_set(table1->write_set, table1->s->primary_key) || - bitmap_is_set(table2->write_set, table2->s->primary_key))) + if (primkey_clustered) { - // Clustered primary key is updated - my_error(ER_MULTI_UPDATE_KEY_CONFLICT, MYF(0), - tl->belong_to_view ? tl->belong_to_view->alias - : tl->alias, - tl2->belong_to_view ? tl2->belong_to_view->alias - : tl2->alias); - return true; + // The primary key can cover multiple columns + KEY key_info= table1->key_info[table1->s->primary_key]; + KEY_PART_INFO *key_part= key_info.key_part; + KEY_PART_INFO *key_part_end= key_part + key_info.key_parts; + + for (;key_part != key_part_end; ++key_part) + { + if (bitmap_is_set(table1->write_set, key_part->fieldnr-1) || + bitmap_is_set(table2->write_set, key_part->fieldnr-1)) + { + // Clustered primary key is updated + my_error(ER_MULTI_UPDATE_KEY_CONFLICT, MYF(0), + tl->belong_to_view ? tl->belong_to_view->alias + : tl->alias, + tl2->belong_to_view ? tl2->belong_to_view->alias + : tl2->alias); + return true; + } + } } } } |